113498266Sopenharmony_ci<testcase> 213498266Sopenharmony_ci# Based on test900 313498266Sopenharmony_ci# N.B. --libcurl output not sufficient to deal with uploaded files. 413498266Sopenharmony_ci<info> 513498266Sopenharmony_ci<keywords> 613498266Sopenharmony_ciSMTP 713498266Sopenharmony_ci--libcurl 813498266Sopenharmony_ci</keywords> 913498266Sopenharmony_ci</info> 1013498266Sopenharmony_ci 1113498266Sopenharmony_ci# 1213498266Sopenharmony_ci# Server-side 1313498266Sopenharmony_ci<reply> 1413498266Sopenharmony_ci<servercmd> 1513498266Sopenharmony_ciCAPA SIZE 1613498266Sopenharmony_ci</servercmd> 1713498266Sopenharmony_ci</reply> 1813498266Sopenharmony_ci 1913498266Sopenharmony_ci# 2013498266Sopenharmony_ci# Client-side 2113498266Sopenharmony_ci<client> 2213498266Sopenharmony_ci<server> 2313498266Sopenharmony_cismtp 2413498266Sopenharmony_ci</server> 2513498266Sopenharmony_ci<name> 2613498266Sopenharmony_ci--libcurl for SMTP 2713498266Sopenharmony_ci</name> 2813498266Sopenharmony_ci<setenv> 2913498266Sopenharmony_ciSSL_CERT_FILE= 3013498266Sopenharmony_ci</setenv> 3113498266Sopenharmony_ci<file name="%LOGDIR/test%TESTNUMBER.eml"> 3213498266Sopenharmony_ciFrom: different 3313498266Sopenharmony_ciTo: another 3413498266Sopenharmony_ci 3513498266Sopenharmony_cibody 3613498266Sopenharmony_ci</file> 3713498266Sopenharmony_ci<command> 3813498266Sopenharmony_cismtp://%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 3913498266Sopenharmony_ci</command> 4013498266Sopenharmony_ci# Need ftp so the FTP options are written in the --libcurl template 4113498266Sopenharmony_ci<features> 4213498266Sopenharmony_ciftp 4313498266Sopenharmony_ci</features> 4413498266Sopenharmony_ci</client> 4513498266Sopenharmony_ci 4613498266Sopenharmony_ci# 4713498266Sopenharmony_ci# Verify data after the test has been "shot" 4813498266Sopenharmony_ci<verify> 4913498266Sopenharmony_ci<protocol> 5013498266Sopenharmony_ciEHLO %TESTNUMBER 5113498266Sopenharmony_ciMAIL FROM:<sender@example.com> SIZE=38 5213498266Sopenharmony_ciRCPT TO:<recipient.one@example.com> 5313498266Sopenharmony_ciRCPT TO:<recipient.two@example.com> 5413498266Sopenharmony_ciDATA 5513498266Sopenharmony_ciQUIT 5613498266Sopenharmony_ci</protocol> 5713498266Sopenharmony_ci<upload> 5813498266Sopenharmony_ciFrom: different 5913498266Sopenharmony_ciTo: another 6013498266Sopenharmony_ci 6113498266Sopenharmony_cibody 6213498266Sopenharmony_ci. 6313498266Sopenharmony_ci</upload> 6413498266Sopenharmony_ci<file name="%LOGDIR/test%TESTNUMBER.c" mode="text"> 6513498266Sopenharmony_ci/********* Sample code generated by the curl command line tool ********** 6613498266Sopenharmony_ci * All curl_easy_setopt() options are documented at: 6713498266Sopenharmony_ci * https://curl.se/libcurl/c/curl_easy_setopt.html 6813498266Sopenharmony_ci ************************************************************************/ 6913498266Sopenharmony_ci#include <curl/curl.h> 7013498266Sopenharmony_ci 7113498266Sopenharmony_ciint main(int argc, char *argv[]) 7213498266Sopenharmony_ci{ 7313498266Sopenharmony_ci CURLcode ret; 7413498266Sopenharmony_ci CURL *hnd; 7513498266Sopenharmony_ci struct curl_slist *slist1; 7613498266Sopenharmony_ci 7713498266Sopenharmony_ci slist1 = NULL; 7813498266Sopenharmony_ci slist1 = curl_slist_append(slist1, "recipient.one@example.com"); 7913498266Sopenharmony_ci slist1 = curl_slist_append(slist1, "recipient.two@example.com"); 8013498266Sopenharmony_ci 8113498266Sopenharmony_ci hnd = curl_easy_init(); 8213498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); 8313498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER"); 8413498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L); 8513498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); 8613498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L); 8713498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); 8813498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com"); 8913498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1); 9013498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); 9113498266Sopenharmony_ci 9213498266Sopenharmony_ci /* Here is a list of options the curl code used that cannot get generated 9313498266Sopenharmony_ci as source easily. You may choose to either not use them or implement 9413498266Sopenharmony_ci them yourself. 9513498266Sopenharmony_ci 9613498266Sopenharmony_ci CURLOPT_WRITEDATA was set to an object pointer 9713498266Sopenharmony_ci CURLOPT_WRITEFUNCTION was set to a function pointer 9813498266Sopenharmony_ci CURLOPT_READDATA was set to an object pointer 9913498266Sopenharmony_ci CURLOPT_READFUNCTION was set to a function pointer 10013498266Sopenharmony_ci CURLOPT_SEEKDATA was set to an object pointer 10113498266Sopenharmony_ci CURLOPT_SEEKFUNCTION was set to a function pointer 10213498266Sopenharmony_ci CURLOPT_ERRORBUFFER was set to an object pointer 10313498266Sopenharmony_ci CURLOPT_STDERR was set to an object pointer 10413498266Sopenharmony_ci CURLOPT_DEBUGFUNCTION was set to a function pointer 10513498266Sopenharmony_ci CURLOPT_DEBUGDATA was set to an object pointer 10613498266Sopenharmony_ci CURLOPT_HEADERFUNCTION was set to a function pointer 10713498266Sopenharmony_ci CURLOPT_HEADERDATA was set to an object pointer 10813498266Sopenharmony_ci 10913498266Sopenharmony_ci */ 11013498266Sopenharmony_ci 11113498266Sopenharmony_ci ret = curl_easy_perform(hnd); 11213498266Sopenharmony_ci 11313498266Sopenharmony_ci curl_easy_cleanup(hnd); 11413498266Sopenharmony_ci hnd = NULL; 11513498266Sopenharmony_ci curl_slist_free_all(slist1); 11613498266Sopenharmony_ci slist1 = NULL; 11713498266Sopenharmony_ci 11813498266Sopenharmony_ci return (int)ret; 11913498266Sopenharmony_ci} 12013498266Sopenharmony_ci/**** End of sample code ****/ 12113498266Sopenharmony_ci</file> 12213498266Sopenharmony_ci<stripfile> 12313498266Sopenharmony_ci# These options vary with configurations - just ignore them 12413498266Sopenharmony_ci# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol 12513498266Sopenharmony_ci$_ = '' if /CURLOPT_USERAGENT/ 12613498266Sopenharmony_ci$_ = '' if /CURLOPT_MAXREDIRS/ 12713498266Sopenharmony_ci$_ = '' if /CURLOPT_SSL_VERIFYPEER/ 12813498266Sopenharmony_ci$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ 12913498266Sopenharmony_ci$_ = '' if /CURLOPT_HTTP_VERSION/ 13013498266Sopenharmony_ci$_ = '' if /CURLOPT_HTTP09_ALLOWED/ 13113498266Sopenharmony_ci$_ = '' if /CURLOPT_INTERLEAVEDATA/ 13213498266Sopenharmony_ci</stripfile> 13313498266Sopenharmony_ci</verify> 13413498266Sopenharmony_ci</testcase> 135