test1406 (3494B)
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="%LOGDIR/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 %LOGDIR/test%TESTNUMBER.eml --libcurl %LOGDIR/test%TESTNUMBER.c 39 </command> 40 # Need ftp so the FTP options are written in the --libcurl template 41 <features> 42 ftp 43 --libcurl 44 </features> 45 </client> 46 47 # 48 # Verify data after the test has been "shot" 49 <verify> 50 <protocol> 51 EHLO %TESTNUMBER 52 MAIL FROM:<sender@example.com> SIZE=38 53 RCPT TO:<recipient.one@example.com> 54 RCPT TO:<recipient.two@example.com> 55 DATA 56 QUIT 57 </protocol> 58 <upload> 59 From: different 60 To: another 61 62 body 63 . 64 </upload> 65 <file name="%LOGDIR/test%TESTNUMBER.c" mode="text"> 66 /********* Sample code generated by the curl command line tool ********** 67 * All curl_easy_setopt() options are documented at: 68 * https://curl.se/libcurl/c/curl_easy_setopt.html 69 ************************************************************************/ 70 #include <curl/curl.h> 71 72 int main(int argc, char *argv[]) 73 { 74 CURLcode ret; 75 CURL *hnd; 76 struct curl_slist *slist1; 77 78 slist1 = NULL; 79 slist1 = curl_slist_append(slist1, "recipient.one@example.com"); 80 slist1 = curl_slist_append(slist1, "recipient.two@example.com"); 81 82 hnd = curl_easy_init(); 83 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); 84 curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); 85 curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER"); 86 curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L); 87 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); 88 curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com"); 89 curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1); 90 curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); 91 92 /* Here is a list of options the curl code used that cannot get generated 93 as source easily. You may choose to either not use them or implement 94 them yourself. 95 96 CURLOPT_DEBUGFUNCTION was set to a function pointer 97 CURLOPT_DEBUGDATA was set to an object pointer 98 CURLOPT_WRITEDATA was set to an object pointer 99 CURLOPT_WRITEFUNCTION was set to a function pointer 100 CURLOPT_READDATA was set to an object pointer 101 CURLOPT_READFUNCTION was set to a function pointer 102 CURLOPT_SEEKDATA was set to an object pointer 103 CURLOPT_SEEKFUNCTION was set to a function pointer 104 CURLOPT_HEADERFUNCTION was set to a function pointer 105 CURLOPT_HEADERDATA was set to an object pointer 106 CURLOPT_ERRORBUFFER was set to an object pointer 107 CURLOPT_STDERR was set to an object pointer 108 109 */ 110 111 ret = curl_easy_perform(hnd); 112 113 curl_easy_cleanup(hnd); 114 hnd = NULL; 115 curl_slist_free_all(slist1); 116 slist1 = NULL; 117 118 return (int)ret; 119 } 120 /**** End of sample code ****/ 121 </file> 122 <stripfile> 123 # These options vary with configurations - just ignore them 124 # CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol 125 $_ = '' if /CURLOPT_USERAGENT/ 126 $_ = '' if /CURLOPT_MAXREDIRS/ 127 $_ = '' if /CURLOPT_SSL_VERIFYPEER/ 128 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ 129 $_ = '' if /CURLOPT_HTTP_VERSION/ 130 $_ = '' if /CURLOPT_HTTP09_ALLOWED/ 131 $_ = '' if /CURLOPT_INTERLEAVEDATA/ 132 </stripfile> 133 </verify> 134 </testcase>