xref: /curl/tests/data/test1406 (revision 361cd3ed)
1<testcase>
2# Based on test900
3# N.B. --libcurl output not sufficient to deal with uploaded files.
4<info>
5<keywords>
6SMTP
7--libcurl
8</keywords>
9</info>
10
11#
12# Server-side
13<reply>
14<servercmd>
15CAPA SIZE
16</servercmd>
17</reply>
18
19#
20# Client-side
21<client>
22<server>
23smtp
24</server>
25<name>
26--libcurl for SMTP
27</name>
28<setenv>
29SSL_CERT_FILE=
30</setenv>
31<file name="%LOGDIR/test%TESTNUMBER.eml">
32From: different
33To: another
34
35body
36</file>
37<command>
38smtp://%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>
42ftp
43</features>
44</client>
45
46#
47# Verify data after the test has been "shot"
48<verify>
49<protocol>
50EHLO %TESTNUMBER
51MAIL FROM:<sender@example.com> SIZE=38
52RCPT TO:<recipient.one@example.com>
53RCPT TO:<recipient.two@example.com>
54DATA
55QUIT
56</protocol>
57<upload>
58From: different
59To: another
60
61body
62.
63</upload>
64<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
65/********* Sample code generated by the curl command line tool **********
66 * All curl_easy_setopt() options are documented at:
67 * https://curl.se/libcurl/c/curl_easy_setopt.html
68 ************************************************************************/
69#include <curl/curl.h>
70
71int main(int argc, char *argv[])
72{
73  CURLcode ret;
74  CURL *hnd;
75  struct curl_slist *slist1;
76
77  slist1 = NULL;
78  slist1 = curl_slist_append(slist1, "recipient.one@example.com");
79  slist1 = curl_slist_append(slist1, "recipient.two@example.com");
80
81  hnd = curl_easy_init();
82  curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
83  curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER");
84  curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
85  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
86  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 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_WRITEDATA was set to an object pointer
97  CURLOPT_WRITEFUNCTION was set to a function pointer
98  CURLOPT_READDATA was set to an object pointer
99  CURLOPT_READFUNCTION was set to a function pointer
100  CURLOPT_SEEKDATA was set to an object pointer
101  CURLOPT_SEEKFUNCTION was set to a function pointer
102  CURLOPT_ERRORBUFFER was set to an object pointer
103  CURLOPT_STDERR was set to an object pointer
104  CURLOPT_DEBUGFUNCTION was set to a function pointer
105  CURLOPT_DEBUGDATA was set to an object pointer
106  CURLOPT_HEADERFUNCTION was set to a function pointer
107  CURLOPT_HEADERDATA 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>
135