Imported Upstream version 7.59.0
[platform/upstream/curl.git] / tests / data / test1406
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/test1406.eml">
32 From: different
33 To: another
34
35 body
36 </file>
37  <command>
38 smtp://%HOSTIP:%SMTPPORT/1406 --mail-rcpt recipient.one@example.com --mail-rcpt recipient.two@example.com --mail-from sender@example.com -T log/test1406.eml --libcurl log/test1406.c
39 </command>
40 </client>
41
42 #
43 # Verify data after the test has been "shot"
44 <verify>
45 <protocol>
46 EHLO 1406
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/test1406.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.haxx.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_INFILESIZE_LARGE, (curl_off_t)38);
80   curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/1406");
81   curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
82   curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
83   curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
84   curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
85   curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com");
86   curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
87
88   /* Here is a list of options the curl code used that cannot get generated
89      as source easily. You may select to either not use them or implement
90      them yourself.
91
92   CURLOPT_WRITEDATA set to a objectpointer
93   CURLOPT_INTERLEAVEDATA set to a objectpointer
94   CURLOPT_WRITEFUNCTION set to a functionpointer
95   CURLOPT_READDATA set to a objectpointer
96   CURLOPT_READFUNCTION set to a functionpointer
97   CURLOPT_SEEKDATA set to a objectpointer
98   CURLOPT_SEEKFUNCTION set to a functionpointer
99   CURLOPT_ERRORBUFFER set to a objectpointer
100   CURLOPT_STDERR set to a objectpointer
101   CURLOPT_DEBUGFUNCTION set to a functionpointer
102   CURLOPT_DEBUGDATA set to a objectpointer
103   CURLOPT_HEADERFUNCTION set to a functionpointer
104   CURLOPT_HEADERDATA set to a objectpointer
105
106   */
107
108   ret = curl_easy_perform(hnd);
109
110   curl_easy_cleanup(hnd);
111   hnd = NULL;
112   curl_slist_free_all(slist1);
113   slist1 = NULL;
114
115   return (int)ret;
116 }
117 /**** End of sample code ****/
118 </file>
119 <stripfile>
120 # These options vary with configurations - just ignore them
121 $_ = '' if /CURLOPT_USERAGENT/
122 $_ = '' if /CURLOPT_MAXREDIRS/
123 $_ = '' if /CURLOPT_SSL_VERIFYPEER/
124 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
125 $_ = '' if /CURLOPT_HTTP_VERSION/
126 </stripfile>
127 </verify>
128 </testcase>