Public Member Functions | Protected Member Functions

zeus::TSMTProtocol Class Reference

#include <SMTProtocol.h>

Inheritance diagram for zeus::TSMTProtocol:
zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TSMTProtocol (const TString &rAddress, Uint uiPort=TCPPORT_SMTP)
 TSMTProtocol (TSocket &rSocket)
 TSMTProtocol (TSocket &rSocket, const TString &rLocalDomainName)
Retval authenticateSession (const TString &rUserName, const TString &rPassword)
bool isAuthenticated () const
bool isConnected () const
Retval sendEMail (TEMail &rMail)

Protected Member Functions

virtual ~TSMTProtocol ()
void close ()
void open (const TString &rLocalDomainName)
bool listRecipients (const TSingleLinkedList< TEMailAddress > &rList)
Uint sendCommand (const TString &rCommand)
Uint sendCommand (const TString &rCommand, const TString &rArgument)
Uint sendCommandWithResponse (const TString &rCommand, TStringList &rlstResponse)
Uint sendCommandWithResponse (const TString &rCommand, const TString &rArgument, TStringList &rlstResponse)

Detailed Description

Implementation of the simple message transfer protocol. The implementation respects SMTP of RFC821 and the extended SMTP of RFC1869. The class tries first to get the functionality of the server using "EHLO". If it fails it automatically switches to "HELO". For authentication call first the authenticateSession() method before sending mails. According to RFC 4954 (authentication) the channel must be authenticated only once.


Constructor & Destructor Documentation

TSMTProtocol::TSMTProtocol ( const TString rAddress,
Uint  uiPort = TCPPORT_SMTP 
)

Creates a SMTP handler out of a server name (address) and the port ID

Parameters:
rAddress: Hostname or address of the server
uiPort: Port ID of the server (default is TCPPORT_SMTP)
TSMTProtocol::TSMTProtocol ( TSocket rSocket )

creates the SMT protocol handler with a connected socket. As domain name the "local.domain.name" is used

Parameters:
rSocket: already connected socket
TSMTProtocol::TSMTProtocol ( TSocket rSocket,
const TString rLocalDomainName 
)

creates the SMT protocol handler with a connected socket

Parameters:
rSocket: already connected socket
rLocalDomainName: any domain name, e.g local.domain.name
TSMTProtocol::~TSMTProtocol (  ) [protected, virtual]

destroys the SMT protocol handler


Member Function Documentation

Retval TSMTProtocol::authenticateSession ( const TString rUserName,
const TString rPassword 
)

Authenticates the SMTP session at the server

Parameters:
rUserName: User of the E-Mail account
rPassword: password of the user
Return values:
RET_ACCESS_DENIED: sender not accepted
RET_NOERROR: authentication OK

m_bAuthenticated && isConnected()

void TSMTProtocol::close (  ) [protected]

closes the connection

bool zeus::TSMTProtocol::isAuthenticated (  ) const [inline]

returns true if the session is authenticated

bool zeus::TSMTProtocol::isConnected (  ) const [inline]

returns if the connection to the SMTP server is OK

bool TSMTProtocol::listRecipients ( const TSingleLinkedList< TEMailAddress > &  rList ) [protected]

lists all recipients to the SMTP server

void TSMTProtocol::open ( const TString rLocalDomainName ) [protected]

Opens a SMTP session

Uint zeus::TSMTProtocol::sendCommand ( const TString rCommand ) [inline, protected]

sends a command to the SMTP

Parameters:
rCommand: SMTP command
Returns:
connection state
Uint zeus::TSMTProtocol::sendCommand ( const TString rCommand,
const TString rArgument 
) [inline, protected]

sends a command with an argument to the SMTP.

Parameters:
rCommand: SMTP command
rArgument: Argument
Returns:
connection state
Uint zeus::TSMTProtocol::sendCommandWithResponse ( const TString rCommand,
const TString rArgument,
TStringList rlstResponse 
) [inline, protected]

sends a command with an argument to the SMTP.

Parameters:
rCommand: SMTP command
rArgument: Argument
rResponse: response
Returns:
connection state
Uint TSMTProtocol::sendCommandWithResponse ( const TString rCommand,
TStringList rlstResponse 
) [protected]

sends a command to the SMTP and returns the response as a parameter

Parameters:
rCommand: SMTP command
rResponse: response
Returns:
connection state
Retval TSMTProtocol::sendEMail ( TEMail rMail )

Sends an E-Mail to the SMTP server

Parameters:
rMail: EMail to send
Return values:
RET_NOERROR: Mail sent to all recipients
RET_REQUEST_FAILED: no connection
RET_SYNTAX_ERROR: Invalid mail syntax
RET_INVALID_ADDRESS: at least one recipient address is invalid
RET_ACCESS_DENIED: sender not accepted

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:28