blob: 033957f607687f4a509dbc65fd57c377f0fbf1b6 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001<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="log/test1406.eml">
32From: different
33To: another
34
35body
36</file>
37 <command>
38smtp://%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>
46EHLO 1406
47MAIL FROM:<sender@example.com> SIZE=38
48RCPT TO:<recipient.one@example.com>
49RCPT TO:<recipient.two@example.com>
50DATA
51QUIT
52</protocol>
53<upload>
54From: different
55To: another
56
57body
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
67int 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>