<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/> <title>mail::ACCOUNT::send</title> <link rel="stylesheet" href="manpage.css" type="text/css"/> <link rel="start" href="index.html" title="Cone: COnsole Newsreader And Emailer"/> <link rel="up" href="synchronous.html" title="mail::ACCOUNT Synchronous API reference"/> <link rel="prev" href="account-searchmessages.html" title="mail::ACCOUNT::searchMessages"/> <link rel="next" href="account-setrights.html" title="mail::ACCOUNT::setRights"/> <link xmlns="" rel="icon" href="icon.gif" type="image/gif"/> <meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/> <!-- Copyright 2002 - 2007 Double Precision, Inc. See COPYING for distribution information. --> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center" rowspan="1"> mail::ACCOUNT::send</th> </tr> <tr> <td width="20%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="account-searchmessages.html" shape="rect">Prev</a> </td> <th width="60%" align="center" rowspan="1" colspan="1"> <span class="structname">mail::ACCOUNT</span> Synchronous API reference</th> <td width="20%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="account-setrights.html" shape="rect">Next</a></td> </tr> </table> <hr/> </div> <div class="refentry" lang="en" xml:lang="en"> <a id="account-send" shape="rect" name="account-send"> </a> <div class="titlepage"/> <div class="refnamediv"> <h2>Name</h2> <p>mail::ACCOUNT::send — Send a message</p> </div> <div class="refsynopsisdiv"> <h2>Synopsis</h2> <div class="literallayout"> <p><br clear="none"/> <br clear="none"/> <br clear="none"/> <br clear="none"/> #include <libmail/sync.H><br clear="none"/> <br clear="none"/> #include <libmail/smtpinfo.H><br clear="none"/> <br clear="none"/> mail::ACCOUNT *mail;<br clear="none"/> <br clear="none"/> class myAddMessagePull : public mail::addMessagePull {<br clear="none"/> <br clear="none"/> public:<br clear="none"/>     std::string getMessageContents();<br clear="none"/> };<br clear="none"/> <br clear="none"/> myAddMessagePull message;<br clear="none"/> <br clear="none"/> mail::smtpInfo info;<br clear="none"/> <br clear="none"/> info.sender="nobody@example.com";<br clear="none"/> <br clear="none"/> info.recipients.push_back("recipient@example.com");<br clear="none"/> <br clear="none"/></p> </div> <div class="funcsynopsis"> <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> <tr> <td rowspan="1" colspan="1"><code class="funcdef">bool ok=mail-><b class="fsfunc">send</b>(</code></td> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1"><var class="pdparam">info</var>,</td> </tr> <tr> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1">const mail::folder * </td> <td rowspan="1" colspan="1"><var class="pdparam">saveFolder</var>,</td> </tr> <tr> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1"> </td> <td rowspan="1" colspan="1"><var class="pdparam">message</var><code>)</code>;</td> </tr> </table> </div> <div class="literallayout"> <p><br clear="none"/> std::string errmsg=mail->getErrmsg();<br clear="none"/></p> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id576798" shape="rect" name="id576798"> </a> <h2>USAGE</h2> <p>This method sends a message via SMTP. The application should create a <span class="structname">mail::ACCOUNT</span> object, and invoke <a class="link" href="account-login.html" title="mail::ACCOUNT::login" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::ACCOUNT::login</span>(3x)</span></a> specifying a <code class="literal">smtp:</code>, <code class="literal">smtps:</code> or <code class="literal">sendmail:</code> <em class="parameter"><code>url</code></em>. The resulting <span class="structname">mail::ACCOUNT</span>'s <code class="function">send</code> method will be able to deliver the <em class="parameter"><code>message</code></em>.</p> <p><em class="parameter"><code>message</code></em>'s <code class="function">getMessageContents</code> specifies the contents of the message, which should be a valid, MIME-formatted message. <code class="function">getMessageContents</code> does not have to return the entire contents of the message at once. <code class="function">addMessage</code> calls <code class="function">getMessageContents</code> repeatedly. <code class="function">getMessageContents</code> should return the next portion of the message with each call. <code class="function">getMessageContents</code> should return an empty string, after providing the entire message contents are provided. <code class="function">getMessageContents</code> will be called repeatedly until it returns an empty string.</p> <div class="refsect2" lang="en" xml:lang="en"> <a id="id576933" shape="rect" name="id576933"> </a> <h3><em class="parameter"><code>saveFolder</code></em></h3> <p><em class="parameter"><code>saveFolder</code></em>, if not <code class="literal">NULL</code>, specifies that a copy of the message should also be saved in this folder. If this mail account uses the experimental <a class="link" href="smap1.html" title="Appendix A. Simple Mail Access Protocol, Version 1" shape="rect">SMAP</a> protocol, a single copy of the message will be transmitted to the <code class="literal">SMAP</code> server, which will file the message in the folder, and send it to the designated recipients. Otherwise the message is manually saved to this folder using <a class="link" href="folder-addmessage.html" title="mail::folder::addMessage" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::folder::addMessage</span>(3x)</span></a>, or <a class="link" href="account-libmail-addmessage.html" title="mail::ACCOUNT::addMessage" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::ACCOUNT::addMessage</span>(3x)</span></a>.</p> </div> <div class="refsect2" lang="en" xml:lang="en"> <a id="id577317" shape="rect" name="id577317"> </a> <h3>The <span class="structname">mail::smtpInfo</span> object</h3> <p><em class="parameter"><code>info</code></em> specifies the following parameters which are used to deliver the message:</p> <pre class="programlisting" xml:space="preserve"> class mail::smtpInfo { public: std::string sender; std::vector<std::string> recipients; std::map<std::string, std::string> options; } ; </pre> <p><em class="structfield"><code>sender</code></em> specifies the sender's E-mail address, in the form of "<em class="replaceable"><code>user</code></em>@<em class="replaceable"><code>domain</code></em>". <em class="structfield"><code>recipients</code></em> is a list of recipients' E-mail addresses. At least one recipient must be specified.</p> <p><em class="structfield"><code>options</code></em> specifies additional parameters for sending E-mail, initialized as follows:</p> <div class="variablelist"> <dl> <dt><span class="term">options.insert(make_pair("novalidate-cert", "1"))</span></dt> <dd> <p>See <a class="link" href="mail-open.html" title="mail::account::open" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::open</span>(3x)</span></a>) for a description of this option.</p> </dd> <dt><span class="term">options.insert(make_pair("cram", "1"))</span></dt> <dd> <p>See <a class="link" href="mail-open.html" title="mail::account::open" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::account::open</span>(3x)</span></a>) for a description of this option.</p> </dd> <dt><span class="term">options.insert(make_pair("DSN", "<em class="replaceable"><code>list</code></em>"))</span></dt> <dd> <p>Request a delivery status notification. <em class="replaceable"><code>list</code></em> is a comma-separated list of the following keywords: "<code class="literal">never</code>" - do not request any receipts, not even non-delivery notices; "<code class="literal">success</code>" - request a delivery confirmation receipt; "<code class="literal">fail</code>" - request a non-delivery notice; "<code class="literal">delay</code>" - request a delayed delivery notice.</p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p>An error will be reported if the mail server does not implement delivery status notifications.</p> </div> </dd> <dt><span class="term">options.insert(make_pair("RET", "hdrs"))</span></dt> <dd> <p>Request that the delivery status notification should not include the entire original message, only its headers.</p> </dd> <dt><span class="term">options.insert(make_pair("RET", "full"))</span></dt> <dd> <p>Request that the delivery status notifications should include the entire original message.</p> </dd> <dt><span class="term">options.insert(make_pair("NOPIPELINING", "1"))</span></dt> <dd> <p>Do not use the <code class="literal">PIPELINING</code> <code class="literal">SMTP</code> extension even if the mail server claims to support it (workaround for buggy firewalls).</p> </dd> <dt><span class="term">options.insert(make_pair("VERP", "1"))</span></dt> <dd> <p>Use the <code class="literal">VERP</code> mailing list extension. If the <em class="structfield"><code>sender</code></em> address is "<em class="replaceable"><code>sender</code></em>@<em class="replaceable"><code>senddomain</code></em>", then a delivery status notification for "<em class="replaceable"><code>recipient</code></em>@<em class="replaceable"><code>recipientdomain</code></em>" will be sent to "<em class="replaceable"><code>sender</code></em>-<em class="replaceable"><code>recipient</code></em>=<em class="replaceable"><code>recipientdomain</code></em>@<em class="replaceable"><code>senddomain</code></em>" (with certain additional details). This option is currently implemented only by the <a class="ulink" href="http://www.courier-mta.org" target="_top" shape="rect">Courier mail server</a>.</p> </dd> <dt><span class="term">options.insert(make_pair("SECURITY", "STARTTLS"))</span></dt> <dd> <p>The message must be sent via TLS, and the recipient's server must present a certificate signed by a trusted, private, certificate authority. This option is currently implemented only by the <a class="ulink" href="http://www.courier-mta.org" target="_top" shape="rect">Courier mail server</a>.</p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p>This is not the standard <code class="literal">STARTTLS</code> <code class="literal">ESMTP</code> extension. <code class="literal">STARTTLS</code> is always used automatically, if it's supported by the mail server.</p> </div> </dd> </dl> </div> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id577750" shape="rect" name="id577750"> </a> <h2>Return Codes</h2> <p>This method returns <code class="literal">true</code> if it succeeds, or <code class="literal">false</code> if it fails. If the method fails, use <em class="structfield"><code>mail::ACCOUNT::getErrmsg()</code></em> to read a brief description of the error.</p> </div> <div class="refsect1" lang="en" xml:lang="en"> <a id="id577786" shape="rect" name="id577786"> </a> <h2>SEE ALSO</h2> <p><a class="link" href="account-login.html" title="mail::ACCOUNT::login" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::ACCOUNT::login</span>(3x)</span></a>.</p> </div> </div> <div class="navfooter"> <hr/> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="account-searchmessages.html" shape="rect">Prev</a> </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="u" href="synchronous.html" shape="rect">Up</a></td> <td width="40%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="account-setrights.html" shape="rect">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top" rowspan="1" colspan="1">mail::ACCOUNT::searchMessages </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="h" href="index.html" shape="rect">Home</a> | <a accesskey="t" href="bk01-toc.html" shape="rect">ToC</a></td> <td width="40%" align="right" valign="top" rowspan="1" colspan="1"> mail::ACCOUNT::setRights</td> </tr> </table> </div> </body> </html>