1 ConeĀ©
2
3MAIL::ACCOUNT::SEND(3x) Cone: COnsole Newsreader And E MAIL::ACCOUNT::SEND(3x)
4
5
6
8 mail::ACCOUNT::send - Send a message
9
11 #include <libmail/sync.H>
12
13 #include <libmail/smtpinfo.H>
14
15 mail::ACCOUNT *mail;
16
17 class myAddMessagePull : public mail::addMessagePull {
18
19 public:
20 std::string getMessageContents();
21 };
22
23 myAddMessagePull message;
24
25 mail::smtpInfo info;
26
27 info.sender="nobody@example.com";
28
29 info.recipients.push_back("recipient@example.com");
30
31
32 bool ok=mail->send(info, const mail::folder *saveFolder, message);
33
34 std::string errmsg=mail->getErrmsg();
35
37 This method sends a message via SMTP. The application should create a
38 mail::ACCOUNT object, and invoke mail::ACCOUNT::login(3x) specifying a
39 smtp:, smtps: or sendmail:url. The resulting mail::ACCOUNT's send
40 method will be able to deliver the message.
41
42 message's getMessageContents specifies the contents of the message,
43 which should be a valid, MIME-formatted message. getMessageContents
44 does not have to return the entire contents of the message at once.
45 addMessage calls getMessageContents repeatedly. getMessageContents
46 should return the next portion of the message with each call.
47 getMessageContents should return an empty string, after providing the
48 entire message contents are provided. getMessageContents will be
49 called repeatedly until it returns an empty string.
50
51 saveFolder
52 saveFolder, if not NULL, specifies that a copy of the message should
53 also be saved in this folder. If this mail account uses the
54 experimental SMAP protocol, a single copy of the message will be
55 transmitted to the SMAP server, which will file the message in the
56 folder, and send it to the designated recipients. Otherwise the message
57 is manually saved to this folder using mail::folder::addMessage(3x), or
58 mail::ACCOUNT::addMessage(3x).
59
60 The mail::smtpInfo object
61 info specifies the following parameters which are used to deliver the
62 message:
63
64 class mail::smtpInfo {
65 public:
66 std::string sender;
67
68 std::vector<std::string> recipients;
69
70 std::map<std::string, std::string> options;
71 } ;
72
73 sender specifies the sender's E-mail address, in the form of
74 "user@domain". recipients is a list of recipients' E-mail addresses.
75 At least one recipient must be specified.
76
77 options specifies additional parameters for sending E-mail, initialized
78 as follows:
79
80 options.insert(make_pair("novalidate-cert", "1"))
81 See mail::account::open(3x)) for a description of this option.
82
83 options.insert(make_pair("cram", "1"))
84 See mail::account::open(3x)) for a description of this option.
85
86 options.insert(make_pair("DSN", "list"))
87 Request a delivery status notification. list is a comma-separated
88 list of the following keywords: "never" - do not request any
89 receipts, not even non-delivery notices; "success" - request a
90 delivery confirmation receipt; "fail" - request a non-delivery
91 notice; "delay" - request a delayed delivery notice.
92
93 Note
94 An error will be reported if the mail server does not implement
95 delivery status notifications.
96
97 options.insert(make_pair("RET", "hdrs"))
98 Request that the delivery status notification should not include
99 the entire original message, only its headers.
100
101 options.insert(make_pair("RET", "full"))
102 Request that the delivery status notifications should include the
103 entire original message.
104
105 options.insert(make_pair("NOPIPELINING", "1"))
106 Do not use the PIPELININGSMTP extension even if the mail server
107 claims to support it (workaround for buggy firewalls).
108
109 options.insert(make_pair("VERP", "1"))
110 Use the VERP mailing list extension. If the sender address is
111 "sender@senddomain", then a delivery status notification for
112 "recipient@recipientdomain" will be sent to
113 "sender-recipient=recipientdomain@senddomain" (with certain
114 additional details). This option is currently implemented only by
115 the Courier mail server[1].
116
117 options.insert(make_pair("SECURITY", "STARTTLS"))
118 The message must be sent via TLS, and the recipient's server must
119 present a certificate signed by a trusted, private, certificate
120 authority. This option is currently implemented only by the Courier
121 mail server[1].
122
123 Note
124 This is not the standard STARTTLSESMTP extension. STARTTLS is
125 always used automatically, if it's supported by the mail
126 server.
127
129 This method returns true if it succeeds, or false if it fails. If the
130 method fails, use mail::ACCOUNT::getErrmsg() to read a brief
131 description of the error.
132
134 mail::ACCOUNT::login(3x).
135
137 Sam Varshavchik
138
140 1. Courier mail server
141 http://www.courier-mta.org
142
143
144
145ConeĀ© 08/25/2016 MAIL::ACCOUNT::SEND(3x)