1mail::ACCOUNT::send(3mxa)il::ACCOUNT Synchronous API referemnaciel::ACCOUNT::send(3x)
2
3
4

NAME

6       mail::ACCOUNT::send - Send a message
7

SYNOPSIS

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
31       bool ok=mail->send (info, const mail::folder *saveFolder, message);
32
33       std::string errmsg=mail->getErrmsg();
34

USAGE

36       This  method sends a message via SMTP.  The application should create a
37       mail::ACCOUNT object, and invoke mail::ACCOUNT::login(3x) specifying  a
38       smtp:,  smtps:  or  sendmail:  url.  The resulting mail::ACCOUNT's send
39       method will be able to deliver the message.
40
41       message's getMessageContents specifies the  contents  of  the  message,
42       which  should  be  a valid, MIME-formatted message.  getMessageContents
43       does not have to return the entire contents of  the  message  at  once.
44       addMessage  calls  getMessageContents  repeatedly.   getMessageContents
45       should return the next portion of the message with each call.   getMes‐
46       sageContents  should return an empty string, after providing the entire
47       message contents  are  provided.   getMessageContents  will  be  called
48       repeatedly until it returns an empty string.
49
50   SAVEFOLDER
51       saveFolder,  if  not  NULL, specifies that a copy of the message should
52       also be saved in this folder.  If this mail account uses the experimen‐
53       tal  SMAP protocol, a single copy of the message will be transmitted to
54       the SMAP server, which will file the message in the folder, and send it
55       to  the designated recipients.  Otherwise the message is manually saved
56       to    this    folder     using     mail::folder::addMessage(3x),     or
57       mail::ACCOUNT::addMessage(3x).
58
59   THE MAIL::SMTPINFO OBJECT
60       info  specifies  the following parameters which are used to deliver the
61       message:
62
63       class mail::smtpInfo {
64       public:
65            std::string sender;
66
67            std::vector<std::string> recipients;
68
69            std::map<std::string, std::string> options;
70       } ;
71
72       sender  specifies  the  sender's  E-mail  address,  in  the   form   of
73       "user@domain".   recipients  is a list of recipients' E-mail addresses.
74       At least one recipient must be specified.
75
76       options specifies additional parameters for sending E-mail, initialized
77       as follows:
78
79       options.insert(make_pair("novalidate-cert", "1"))
80              See mail::account::open(3x)) for a description of this option.
81
82       options.insert(make_pair("cram", "1"))
83              See mail::account::open(3x)) for a description of this option.
84
85       options.insert(make_pair("DSN", "list"))
86              Request  a  delivery status notification.  list is a comma-sepa‐
87              rated list of the following keywords: "never" - do  not  request
88              any receipts, not even non-delivery notices; "success" - request
89              a delivery confirmation receipt; "fail" - request a non-delivery
90              notice; "delay" - request a delayed delivery notice.
91
92              Note:  An  error  will  be  reported if the mail server does not
93              implement 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
101              the 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  "sender-recipi‐
111              ent=recipientdomain@senddomain"   (with    certain    additional
112              details).   This  option  is  currently  implemented only by the
113              Courier mail server.
114
115       options.insert(make_pair("SECURITY", "STARTTLS"))
116              The message must be sent via TLS,  and  the  recipient's  server
117              must  present  a  certificate signed by a trusted, private, cer‐
118              tificate authority.  This option is currently  implemented  only
119              by the Courier mail server.
120
121              Note: This is not the standard STARTTLS ESMTP extension.  START‐
122              TLS is always used automatically, if it's supported by the  mail
123              server.
124

RETURN CODES

126       This  method returns true if it succeeds, or false if it fails.  If the
127       method fails, use mail::ACCOUNT::getErrmsg() to read a  brief  descrip‐
128       tion of the error.
129

SEE ALSO

131       mail::ACCOUNT::login(3x).
132
133
134
135                                 10 April 2006         mail::ACCOUNT::send(3x)
Impressum