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