<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Class Poco::Net::SMTPClientSession</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.Net.html" class="namespace">Poco::Net</a></h1> <h1 class="symbol">class SMTPClientSession</h1> </div> <div class="body"> <p> <b>Library:</b> Net<br /> <b>Package:</b> Mail<br /> <b>Header:</b> Poco/Net/SMTPClientSession.h</p> <h2>Description</h2> <div class="description"> <p>This class implements an Simple Mail Transfer Procotol (SMTP, <a href="http://www.ietf.org/rfc/rfc2821.txt" target="_blank">RFC 2821</a>) client for sending e-mail messages. </p> </div> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.Net.SMTPClientSession.html#14898" title="Poco::Net::SMTPClientSession::close()">close</a>, <a href="Poco.Net.SMTPClientSession.html#14889" title="Poco::Net::SMTPClientSession::getTimeout()">getTimeout</a>, <a href="Poco.Net.SMTPClientSession.html#14921" title="Poco::Net::SMTPClientSession::isPermanentNegative()">isPermanentNegative</a>, <a href="Poco.Net.SMTPClientSession.html#14915" title="Poco::Net::SMTPClientSession::isPositiveCompletion()">isPositiveCompletion</a>, <a href="Poco.Net.SMTPClientSession.html#14917" title="Poco::Net::SMTPClientSession::isPositiveIntermediate()">isPositiveIntermediate</a>, <a href="Poco.Net.SMTPClientSession.html#14919" title="Poco::Net::SMTPClientSession::isTransientNegative()">isTransientNegative</a>, <a href="Poco.Net.SMTPClientSession.html#14890" title="Poco::Net::SMTPClientSession::login()">login</a>, <a href="Poco.Net.SMTPClientSession.html#14926" title="Poco::Net::SMTPClientSession::loginUsingCRAM_MD5()">loginUsingCRAM_MD5</a>, <a href="Poco.Net.SMTPClientSession.html#14929" title="Poco::Net::SMTPClientSession::loginUsingLogin()">loginUsingLogin</a>, <a href="Poco.Net.SMTPClientSession.html#14932" title="Poco::Net::SMTPClientSession::loginUsingPlain()">loginUsingPlain</a>, <a href="Poco.Net.SMTPClientSession.html#14897" title="Poco::Net::SMTPClientSession::open()">open</a>, <a href="Poco.Net.SMTPClientSession.html#14901" title="Poco::Net::SMTPClientSession::sendCommand()">sendCommand</a>, <a href="Poco.Net.SMTPClientSession.html#14899" title="Poco::Net::SMTPClientSession::sendMessage()">sendMessage</a>, <a href="Poco.Net.SMTPClientSession.html#14887" title="Poco::Net::SMTPClientSession::setTimeout()">setTimeout</a></p> <h2>Enumerations</h2> <h3><i>Anonymous</i></h3> <div class="description"> <p></p> </div> <p class="decl"><a name="14876">SMTP_PORT</a> = 25</p> <div class="description"> <p></p> </div> <h3><i>Anonymous</i> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <div class="description"> <p></p> </div> <p class="decl"><a name="14914">DEFAULT_TIMEOUT</a> = 30000000</p> <div class="description"> <p></p> </div> <h3><a name="14877">LoginMethod</a></h3> <div class="description"> <p></p> </div> <p class="decl"><a name="14878">AUTH_NONE</a></p> <div class="description"> <p></p> </div> <p class="decl"><a name="14879">AUTH_CRAM_MD5</a></p> <div class="description"> <p></p> </div> <p class="decl"><a name="14880">AUTH_LOGIN</a></p> <div class="description"> <p></p> </div> <h3><a name="14908">StatusClass</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <div class="description"> <p></p> </div> <p class="decl"><a name="14909">SMTP_POSITIVE_COMPLETION</a> = 2</p> <div class="description"> <p></p> </div> <p class="decl"><a name="14910">SMTP_POSITIVE_INTERMEDIATE</a> = 3</p> <div class="description"> <p></p> </div> <p class="decl"><a name="14911">SMTP_TRANSIENT_NEGATIVE</a> = 4</p> <div class="description"> <p></p> </div> <p class="decl"><a name="14912">SMTP_PERMANENT_NEGATIVE</a> = 5</p> <div class="description"> <p></p> </div> <h2>Constructors</h2> <h3><a name="14881">SMTPClientSession</a></h3> <p class="decl">explicit <a href="Poco.Net.SMTPClientSession.html" title="class Poco::Net::SMTPClientSession">SMTPClientSession</a>(<br /> const <a href="Poco.Net.StreamSocket.html" title="class Poco::Net::StreamSocket">StreamSocket</a> & socket<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.SMTPClientSession.html" title="class Poco::Net::SMTPClientSession">SMTPClientSession</a> using the given socket, which must be connected to a SMTP server. </p> </div> <h3><a name="14883">SMTPClientSession</a></h3> <p class="decl"><a href="Poco.Net.SMTPClientSession.html" title="class Poco::Net::SMTPClientSession">SMTPClientSession</a>(<br /> const std::string & host,<br /> <a href="Poco.html#11352" title="Poco::UInt16">Poco::UInt16</a> port = SMTP_PORT<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.SMTPClientSession.html" title="class Poco::Net::SMTPClientSession">SMTPClientSession</a> using a socket connected to the given host and port. </p> </div> <h2>Destructor</h2> <h3><a name="14886">~SMTPClientSession</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">virtual ~<a href="Poco.Net.SMTPClientSession.html" title="class Poco::Net::SMTPClientSession">SMTPClientSession</a>();</p> <div class="description"> <p>Destroys the <a href="Poco.Net.SMTPClientSession.html" title="class Poco::Net::SMTPClientSession">SMTPClientSession</a>. </p> </div> <h2>Member Functions</h2> <h3><a name="14898">close</a></h3> <p class="decl">void close();</p> <div class="description"> <p>Sends a QUIT command and closes the connection to the server. </p> <p>Throws a <a href="Poco.Net.SMTPException.html" title="class Poco::Net::SMTPException">SMTPException</a> in case of a SMTP-specific error, or a <a href="Poco.Net.NetException.html" title="class Poco::Net::NetException">NetException</a> in case of a general network communication failure. </p> </div> <h3><a name="14889">getTimeout</a></h3> <p class="decl"><a href="Poco.Timespan.html" title="class Poco::Timespan">Poco::Timespan</a> getTimeout() const;</p> <div class="description"> <p>Returns the timeout for socket read operations. </p> </div> <h3><a name="14890">login</a></h3> <p class="decl">void login(<br /> const std::string & hostname<br />);</p> <div class="description"> <p>Greets the SMTP server by sending a EHLO command with the given hostname as argument. </p> <p>If the server does not understand the EHLO command, a HELO command is sent instead. </p> <p>Throws a <a href="Poco.Net.SMTPException.html" title="class Poco::Net::SMTPException">SMTPException</a> in case of a SMTP-specific error, or a <a href="Poco.Net.NetException.html" title="class Poco::Net::NetException">NetException</a> in case of a general network communication failure. </p> </div> <h3><a name="14892">login</a></h3> <p class="decl">void login();</p> <div class="description"> <p>Calls <a href="Poco.Net.SMTPClientSession.html#14890" title="Poco::Net::SMTPClientSession::login()">login</a>(hostname) with the current host name. </p> </div> <h3><a name="14893">login</a></h3> <p class="decl">void login(<br /> <a href="Poco.Net.SMTPClientSession.html#14877" title="enum Poco::Net::SMTPClientSession::LoginMethod">LoginMethod</a> loginMethod,<br /> const std::string & username,<br /> const std::string & password<br />);</p> <div class="description"> <p>Logs in to the SMTP server using the given authentication method and the given credentials. </p> </div> <h3><a name="14897">open</a></h3> <p class="decl">void open();</p> <div class="description"> <p>Reads the initial response from the SMTP server. </p> <p>Usually called implicitly through <a href="Poco.Net.SMTPClientSession.html#14890" title="Poco::Net::SMTPClientSession::login()">login</a>(), but can also be called explicitly to implement different forms of SMTP authentication. </p> <p>Does nothing if called more than once. </p> </div> <h3><a name="14901">sendCommand</a></h3> <p class="decl">int sendCommand(<br /> const std::string & command,<br /> std::string & response<br />);</p> <div class="description"> <p>Sends the given command verbatim to the server and waits for a response. </p> <p>Throws a <a href="Poco.Net.SMTPException.html" title="class Poco::Net::SMTPException">SMTPException</a> in case of a SMTP-specific error, or a <a href="Poco.Net.NetException.html" title="class Poco::Net::NetException">NetException</a> in case of a general network communication failure. </p> </div> <h3><a name="14904">sendCommand</a></h3> <p class="decl">int sendCommand(<br /> const std::string & command,<br /> const std::string & arg,<br /> std::string & response<br />);</p> <div class="description"> <p>Sends the given command verbatim to the server and waits for a response. </p> <p>Throws a <a href="Poco.Net.SMTPException.html" title="class Poco::Net::SMTPException">SMTPException</a> in case of a SMTP-specific error, or a <a href="Poco.Net.NetException.html" title="class Poco::Net::NetException">NetException</a> in case of a general network communication failure. </p> </div> <h3><a name="14899">sendMessage</a></h3> <p class="decl">void sendMessage(<br /> const <a href="Poco.Net.MailMessage.html" title="class Poco::Net::MailMessage">MailMessage</a> & message<br />);</p> <div class="description"> <p>Sends the given mail message by sending a MAIL FROM command, a RCPT TO command for every recipient, and a DATA command with the message headers and content. </p> <p>Throws a <a href="Poco.Net.SMTPException.html" title="class Poco::Net::SMTPException">SMTPException</a> in case of a SMTP-specific error, or a <a href="Poco.Net.NetException.html" title="class Poco::Net::NetException">NetException</a> in case of a general network communication failure. </p> </div> <h3><a name="14887">setTimeout</a></h3> <p class="decl">void setTimeout(<br /> const <a href="Poco.Timespan.html" title="class Poco::Timespan">Poco::Timespan</a> & timeout<br />);</p> <div class="description"> <p>Sets the timeout for socket read operations. </p> </div> <h3><a name="14921">isPermanentNegative</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static bool isPermanentNegative(<br /> int status<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14915">isPositiveCompletion</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static bool isPositiveCompletion(<br /> int status<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14917">isPositiveIntermediate</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static bool isPositiveIntermediate(<br /> int status<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14919">isTransientNegative</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static bool isTransientNegative(<br /> int status<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14923">login</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void login(<br /> const std::string & hostname,<br /> std::string & response<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14926">loginUsingCRAM_MD5</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void loginUsingCRAM_MD5(<br /> const std::string & username,<br /> const std::string & password<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14929">loginUsingLogin</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void loginUsingLogin(<br /> const std::string & username,<br /> const std::string & password<br />);</p> <div class="description"> <p></p> </div> <h3><a name="14932">loginUsingPlain</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void loginUsingPlain(<br /> const std::string & username,<br /> const std::string & password<br />);</p> <div class="description"> <p></p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>