1MAIL::ACCOUNT::GETSE(3x)Cone: COnsole Newsreader And EMAIL::ACCOUNT::GETSE(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 mail::folder *folder=account->getSendFolder(const mail::smtpInfo &info,
32 const mail::folder *saveFolder,
33 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
52 Multiple messages may be copied to this mail::folder. Each messages
53 is E-mail separately, to all recipients. Excersize caution to
54 prevent an accidental request to copy an entire folder, with
55 thousand messages, to a thousand recipients.
56
57 saveFolder
58 saveFolder, if not NULL, specifies that a copy of the message should
59 also be saved in this folder. If this mail account uses the
60 experimental SMAP protocol, a single copy of the message will be
61 transmitted to the SMAP server, which will file the message in the
62 folder, and send it to the designated recipients. Otherwise the message
63 is manually saved to this folder using mail::folder::addMessage(3x), or
64 mail::ACCOUNT::addMessage(3x).
65
66 The mail::smtpInfo object
67 info specifies the following parameters which are used to deliver the
68 message:
69
70 class mail::smtpInfo {
71 public:
72 std::string sender;
73
74 std::vector<std::string> recipients;
75
76 std::map<std::string, std::string> options;
77 } ;
78
79 sender specifies the sender´s E-mail address, in the form of
80 "user@domain". recipients is a list of recipients´ E-mail addresses.
81 At least one recipient must be specified.
82
83 options specifies additional parameters for sending E-mail, initialized
84 as follows:
85
86 options.insert(make_pair("novalidate-cert", "1"))
87 See mail::account::open(3x)) for a description of this option.
88
89 options.insert(make_pair("cram", "1"))
90 See mail::account::open(3x)) for a description of this option.
91
92 options.insert(make_pair("DSN", "list"))
93 Request a delivery status notification. list is a comma-separated
94 list of the following keywords: "never" - do not request any
95 receipts, not even non-delivery notices; "success" - request a
96 delivery confirmation receipt; "fail" - request a non-delivery
97 notice; "delay" - request a delayed delivery notice.
98
99 Note
100 An error will be reported if the mail server does not implement
101 delivery status notifications.
102
103 options.insert(make_pair("RET", "hdrs"))
104 Request that the delivery status notification should not include
105 the entire original message, only its headers.
106
107 options.insert(make_pair("RET", "full"))
108 Request that the delivery status notifications should include the
109 entire original message.
110
111 options.insert(make_pair("NOPIPELINING", "1"))
112 Do not use the PIPELINING SMTP extension even if the mail server
113 claims to support it (workaround for buggy firewalls).
114
115 options.insert(make_pair("VERP", "1"))
116 Use the VERP mailing list extension. If the sender address is
117 "sender@senddomain", then a delivery status notification for
118 "recipient@recipientdomain" will be sent to
119 "sender-recipient=recipientdomain@senddomain" (with certain
120 additional details). This option is currently implemented only by
121 the Courier mail server[1].
122
123 options.insert(make_pair("SECURITY", "STARTTLS"))
124 The message must be sent via TLS, and the recipient´s server must
125 present a certificate signed by a trusted, private, certificate
126 authority. This option is currently implemented only by the Courier
127 mail server[1].
128
129 Note
130 This is not the standard STARTTLS ESMTP extension. STARTTLS is
131 always used automatically, if it´s supported by the mail
132 server.
133
135 mail::account::getSendFolder returns NULL if this mail::account object
136 is not capable of sending mail. errmsg is initialized with an
137 appropriate error message.
138
140 mail::account::open(3x).
141
143 1. Courier mail server
144 http://www.courier-mta.org
145
146
147
148[FIXME: source] 05/08/2010 MAIL::ACCOUNT::GETSE(3x)