#include <ThreadedSMTPConnection.h>
Inherits SmtpThread::Thread.
Inheritance diagram for SmtpThread::ThreadedSMTPConnection:
Public Member Functions | |
ThreadedSMTPConnection () | |
ThreadedSMTPConnection (string host) | |
ThreadedSMTPConnection (string host, string myname) | |
void | Execute (void *arg) |
bool | isReady () |
SMTPConnection::SMTPState | getSMTPState () |
void | setSMTPHost (string host) |
void | setSMTPPort (int port) |
void | setMyHostname (string myname) |
void | sendMail (string &from, string &to, string &msg) |
This class is inherited from the Thread-class. This means, you can initialize a ThreadedSMTPConnection-object, setup your ThreadedSMTPConnection, start threading and push a message to the ThreadedSMTPConnection. While the ThreadedSMTPConnection sends the message in its thread, you can continue doing other stuff.
ThreadedSMTPConnection speaks plain SMTP, no ESMTP.
SmtpThread::ThreadedSMTPConnection::ThreadedSMTPConnection | ( | ) |
Default constructor.
SmtpThread::ThreadedSMTPConnection::ThreadedSMTPConnection | ( | string | host | ) |
Constructor. Initializes the smtp-connection to "host".
host | IP-address of the host to connect to. |
SmtpThread::ThreadedSMTPConnection::ThreadedSMTPConnection | ( | string | host, | |
string | myname | |||
) |
Constructor. Initializes the smtp-connection to "host" and uses myname
as hostname.
host | IP-address of the host to connect to. | |
myname | hostname for the HELO-command. |
void SmtpThread::ThreadedSMTPConnection::Execute | ( | void * | arg | ) | [virtual] |
The main thread-loop. Checks whether or not a mail is provided to the object and sends the mail.
arg | pointer to the arguments. |
Reimplemented from SmtpThread::Thread.
bool SmtpThread::ThreadedSMTPConnection::isReady | ( | ) |
Returns the current status of the thread.
SMTPConnection::SMTPState SmtpThread::ThreadedSMTPConnection::getSMTPState | ( | ) |
Returns the current state of the SMTP-dialog.
void SmtpThread::ThreadedSMTPConnection::setSMTPHost | ( | string | host | ) |
Sets the IP-address of the SMTP-server.
NOTE: Must be an IP-address and not a domain-name!
host | IP-adress of SMTP-server. |
void SmtpThread::ThreadedSMTPConnection::setSMTPPort | ( | int | port | ) |
Sets the port-number to connect to.
port | Port-number of the SMTP-server. |
void SmtpThread::ThreadedSMTPConnection::setMyHostname | ( | string | myname | ) |
Sets the hostname to send within the HELO-command.
myname | Hostname of the sending host. |
void SmtpThread::ThreadedSMTPConnection::sendMail | ( | string & | from, | |
string & | to, | |||
string & | msg | |||
) |
Send an email to the SMTP-server.
from | email-address of the sender. | |
to | email-address of the receiver. | |
msg | email-body, including all additional headers. |