xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 1 | <testcase> |
| 2 | # Based on test900 |
| 3 | # N.B. --libcurl output not sufficient to deal with uploaded files. |
| 4 | <info> |
| 5 | <keywords> |
| 6 | SMTP |
| 7 | --libcurl |
| 8 | </keywords> |
| 9 | </info> |
| 10 | |
| 11 | # |
| 12 | # Server-side |
| 13 | <reply> |
| 14 | <servercmd>
|
| 15 | CAPA SIZE
|
| 16 | </servercmd>
|
| 17 | </reply> |
| 18 | |
| 19 | # |
| 20 | # Client-side |
| 21 | <client> |
| 22 | <server> |
| 23 | smtp |
| 24 | </server> |
| 25 | <name> |
| 26 | --libcurl for SMTP |
| 27 | </name> |
| 28 | <setenv> |
| 29 | SSL_CERT_FILE= |
| 30 | </setenv> |
| 31 | <file name="log/test%TESTNUMBER.eml"> |
| 32 | From: different
|
| 33 | To: another
|
| 34 |
|
| 35 | body
|
| 36 | </file> |
| 37 | <command> |
| 38 | smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient.one@example.com --mail-rcpt recipient.two@example.com --mail-from sender@example.com -T log/test%TESTNUMBER.eml --libcurl log/test%TESTNUMBER.c |
| 39 | </command> |
| 40 | </client> |
| 41 | |
| 42 | # |
| 43 | # Verify data after the test has been "shot" |
| 44 | <verify> |
| 45 | <protocol> |
| 46 | EHLO %TESTNUMBER
|
| 47 | MAIL FROM:<sender@example.com> SIZE=38
|
| 48 | RCPT TO:<recipient.one@example.com>
|
| 49 | RCPT TO:<recipient.two@example.com>
|
| 50 | DATA
|
| 51 | QUIT
|
| 52 | </protocol> |
| 53 | <upload> |
| 54 | From: different
|
| 55 | To: another
|
| 56 |
|
| 57 | body
|
| 58 | .
|
| 59 | </upload> |
| 60 | <file name="log/test%TESTNUMBER.c" mode="text"> |
| 61 | /********* Sample code generated by the curl command line tool ********** |
| 62 | * All curl_easy_setopt() options are documented at: |
| 63 | * https://curl.se/libcurl/c/curl_easy_setopt.html |
| 64 | ************************************************************************/ |
| 65 | #include <curl/curl.h> |
| 66 | |
| 67 | int main(int argc, char *argv[]) |
| 68 | { |
| 69 | CURLcode ret; |
| 70 | CURL *hnd; |
| 71 | struct curl_slist *slist1; |
| 72 | |
| 73 | slist1 = NULL; |
| 74 | slist1 = curl_slist_append(slist1, "recipient.one@example.com"); |
| 75 | slist1 = curl_slist_append(slist1, "recipient.two@example.com"); |
| 76 | |
| 77 | hnd = curl_easy_init(); |
| 78 | curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); |
| 79 | curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER"); |
| 80 | curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L); |
| 81 | curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); |
| 82 | curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L); |
| 83 | curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); |
| 84 | curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com"); |
| 85 | curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1); |
| 86 | curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); |
| 87 | |
| 88 | /* Here is a list of options the curl code used that cannot get generated |
| 89 | as source easily. You may choose to either not use them or implement |
| 90 | them yourself. |
| 91 | |
| 92 | CURLOPT_WRITEDATA was set to an object pointer |
| 93 | CURLOPT_WRITEFUNCTION was set to a function pointer |
| 94 | CURLOPT_READDATA was set to an object pointer |
| 95 | CURLOPT_READFUNCTION was set to a function pointer |
| 96 | CURLOPT_SEEKDATA was set to an object pointer |
| 97 | CURLOPT_SEEKFUNCTION was set to a function pointer |
| 98 | CURLOPT_ERRORBUFFER was set to an object pointer |
| 99 | CURLOPT_STDERR was set to an object pointer |
| 100 | CURLOPT_DEBUGFUNCTION was set to a function pointer |
| 101 | CURLOPT_DEBUGDATA was set to an object pointer |
| 102 | CURLOPT_HEADERFUNCTION was set to a function pointer |
| 103 | CURLOPT_HEADERDATA was set to an object pointer |
| 104 | |
| 105 | */ |
| 106 | |
| 107 | ret = curl_easy_perform(hnd); |
| 108 | |
| 109 | curl_easy_cleanup(hnd); |
| 110 | hnd = NULL; |
| 111 | curl_slist_free_all(slist1); |
| 112 | slist1 = NULL; |
| 113 | |
| 114 | return (int)ret; |
| 115 | } |
| 116 | /**** End of sample code ****/ |
| 117 | </file> |
| 118 | <stripfile> |
| 119 | # These options vary with configurations - just ignore them |
| 120 | # CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol |
| 121 | $_ = '' if /CURLOPT_USERAGENT/ |
| 122 | $_ = '' if /CURLOPT_MAXREDIRS/ |
| 123 | $_ = '' if /CURLOPT_SSL_VERIFYPEER/ |
| 124 | $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ |
| 125 | $_ = '' if /CURLOPT_HTTP_VERSION/ |
| 126 | $_ = '' if /CURLOPT_HTTP09_ALLOWED/ |
| 127 | $_ = '' if /CURLOPT_INTERLEAVEDATA/ |
| 128 | </stripfile> |
| 129 | </verify> |
| 130 | </testcase> |