SmtpThread::SMTPConnection Class Reference

#include <SMTPConnection.h>

List of all members.

Public Types

enum  SMTPState

Public Member Functions

 SMTPConnection ()
 SMTPConnection (string host)
 SMTPConnection (string host, string myname)
 ~SMTPConnection ()
SMTPState getSMTPState ()
void setSMTPHost (string host)
void setSMTPPort (int port)
void setMyHostname (string myname)
int sendMail (string &from, string &to, string &msg)
void disconnect ()


Detailed Description

SMTPConnection-Class.

This class is inherited from the Thread-class. This means, you can initialize a SMTPConnection-object, setup your SMTPConnection, start threading and push a message to the SMTPConnection. While the SMTPConnection send the message in its thread, you can continue doing other stuff.

SMTPConnection speaks plain SMTP, no ESMTP.


Member Enumeration Documentation

enum SmtpThread::SMTPConnection::SMTPState

Definition of the possible states of an SMTP-connection.


Constructor & Destructor Documentation

SmtpThread::SMTPConnection::SMTPConnection (  ) 

Constructor.

SmtpThread::SMTPConnection::SMTPConnection ( string  host  ) 

Constructor. Initializes the smtp-connection to "host".

Parameters:
host IP-address of the host to connect to.

SmtpThread::SMTPConnection::SMTPConnection ( string  host,
string  myname 
)

Constructor. Initializes the smtp-connection to "host" and uses myname as hostname.

Parameters:
host IP-address of the host to connect to.
myname hostname for the HELO-command.

SmtpThread::SMTPConnection::~SMTPConnection (  ) 

Destructor.


Member Function Documentation

SMTPConnection::SMTPState SmtpThread::SMTPConnection::getSMTPState (  ) 

Gets the current state of the connection. Since this is an unthreaded class, this will either be "SMTPState::NOT_CONNECTED" or "SMTPState::CONNECTED".

Returns:
state of the current connection.

void SmtpThread::SMTPConnection::setSMTPHost ( string  host  ) 

Sets the IP of the SMTP-host to connect to.

Parameters:
host IP-address of SMTP-host.

void SmtpThread::SMTPConnection::setSMTPPort ( int  port  ) 

Sets the port-number of the SMTP-host to connect to.

Parameters:
port Port-number on SMTP-host.

void SmtpThread::SMTPConnection::setMyHostname ( string  myname  ) 

Sets the hostname to send in the HELO-command of the SMTP-dialog.

Parameters:
myname HELO-hostname.

int SmtpThread::SMTPConnection::sendMail ( string &  from,
string &  to,
string &  msg 
)

Sends a mail via SMTP.

Parameters:
from FROM-email
to TO-email
msg Message-body of email. Should include additional headers like "Subject" etc.
Returns:
status: 0 = success, -1 = error

void SmtpThread::SMTPConnection::disconnect (  ) 

When connected, disconnects from the SMTP-Server.


Generated on Sun Dec 2 13:20:05 2007 for libSmtpThread by  doxygen 1.5.1