1mail::account::getSendFmoalidle:r:(a3cxc)ount Native APImraeifle:r:eanccceount::getSendFolder(3x)
2
3
4
6 mail::account::getSendFolder - Create a folder object for sending mail
7
9 #include <libmail/mail.H>
10
11
12 class myCallback : public mail::callback {
13 public:
14 void success(std::string msg);
15 void fail(std::string msg);
16 };
17
18
19 #include <libmail/smtpinfo.H>
20 #include <libmail/addmessage.H>
21
22 mail::account *account;
23
24 mail::smtpInfo info;
25
26 info.sender="nobody@example.com";
27
28 info.recipients.push_back("recipient@example.com");
29
30
31
32 mail::folder *folder=account->getSendFolder (const mail::smtpInfo
33 &info, const mail::folder *saveFolder, std::string errmsg);
34
35 myCallback sendCallback;
36
37 mail::addMessage *addMessage= folder->addMessage(sendCallback);
38
39 addMessage->saveMessageContents(std::string messageText);
40 addMessage->go();
41
43 This function creates a special folder object: copying a message to
44 this folder will E-mail it to the designated recipient list. The
45 mail::account object must be an account that's capable of creating this
46 kind of a folder (such as smtp accounts created by
47 mail::account::open(3x)). The message may be manually added to the
48 folder with mail::folder::addmessage(3x), or by copying a message from
49 another folder using mail::folder::copyMessagesTo(3x).
50
51 Note: Multiple messages may be copied to this mail::folder.
52 Each messages is E-mail separately, to all recipients. Excer‐
53 size caution to prevent an accidental request to copy an entire
54 folder, with thousand messages, to a thousand recipients.
55
56 SAVEFOLDER
57 saveFolder, if not NULL, specifies that a copy of the message should
58 also be saved in this folder. If this mail account uses the experimen‐
59 tal SMAP protocol, a single copy of the message will be transmitted to
60 the SMAP server, which will file the message in the folder, and send it
61 to the designated recipients. Otherwise the message is manually saved
62 to this folder using mail::folder::addMessage(3x), or
63 mail::ACCOUNT::addMessage(3x).
64
65 THE MAIL::SMTPINFO OBJECT
66 info specifies the following parameters which are used to deliver the
67 message:
68
69 class mail::smtpInfo {
70 public:
71 std::string sender;
72
73 std::vector<std::string> recipients;
74
75 std::map<std::string, std::string> options;
76 } ;
77
78 sender specifies the sender's E-mail address, in the form of
79 "user@domain". recipients is a list of recipients' E-mail addresses.
80 At least one recipient must be specified.
81
82 options specifies additional parameters for sending E-mail, initialized
83 as follows:
84
85 options.insert(make_pair("novalidate-cert", "1"))
86 See mail::account::open(3x)) for a description of this option.
87
88 options.insert(make_pair("cram", "1"))
89 See mail::account::open(3x)) for a description of this option.
90
91 options.insert(make_pair("DSN", "list"))
92 Request a delivery status notification. list is a comma-sepa‐
93 rated list of the following keywords: "never" - do not request
94 any receipts, not even non-delivery notices; "success" - request
95 a delivery confirmation receipt; "fail" - request a non-delivery
96 notice; "delay" - request a delayed delivery notice.
97
98 Note: An error will be reported if the mail server does not
99 implement delivery status notifications.
100
101 options.insert(make_pair("RET", "hdrs"))
102 Request that the delivery status notification should not include
103 the entire original message, only its headers.
104
105 options.insert(make_pair("RET", "full"))
106 Request that the delivery status notifications should include
107 the entire original message.
108
109 options.insert(make_pair("NOPIPELINING", "1"))
110 Do not use the PIPELINING SMTP extension even if the mail server
111 claims to support it (workaround for buggy firewalls).
112
113 options.insert(make_pair("VERP", "1"))
114 Use the VERP mailing list extension. If the sender address is
115 "sender@senddomain", then a delivery status notification for
116 "recipient@recipientdomain" will be sent to "sender-recipi‐
117 ent=recipientdomain@senddomain" (with certain additional
118 details). This option is currently implemented only by the
119 Courier mail server.
120
121 options.insert(make_pair("SECURITY", "STARTTLS"))
122 The message must be sent via TLS, and the recipient's server
123 must present a certificate signed by a trusted, private, cer‐
124 tificate authority. This option is currently implemented only
125 by the Courier mail server.
126
127 Note: This is not the standard STARTTLS ESMTP extension. START‐
128 TLS is always used automatically, if it's supported by the mail
129 server.
130
132 mail::account::getSendFolder returns NULL if this mail::account object
133 is not capable of sending mail. errmsg is initialized with an appro‐
134 priate error message.
135
137 mail::account::open(3x).
138
139
140
141 10 April 2006mail::account::getSendFolder(3x)