Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

PSMTPClient Class Reference

#include <inetmail.h>

Inheritance diagram for PSMTPClient:

PSMTP PInternetProtocol PIndirectChannel PChannel PObject List of all members.

Public Methods

 PSMTPClient ()
 ~PSMTPClient ()
virtual BOOL Close ()
BOOL LogIn (const PString &username, const PString &password)
BOOL BeginMessage (const PString &from, const PString &to, BOOL eightBitMIME=FALSE)
BOOL BeginMessage (const PString &from, const PStringList &toList, BOOL eightBitMIME=FALSE)
BOOL EndMessage ()

Protected Methods

BOOL OnOpen ()

Protected Attributes

BOOL haveHello
BOOL extendedHello
BOOL eightBitMIME
PString fromAddress
PStringList toNames
BOOL sendingData

Detailed Description

A TCP/IP socket for the Simple Mail Transfer Protocol.

When acting as a client, the procedure is to make the connection to a remote server, then to send a message using the following procedure:


      PSMTPSocket mail("mailserver");
      if (mail.IsOpen()) {
        mail.BeginMessage("Me@here.com.au", "Fred@somwhere.com");
        mail.Write(myMessage);
        if (!mail.EndMessage())
          PError << "Mail send failed." << endl;
      }
      else
         PError << "Mail conection failed." << endl;
      


Constructor & Destructor Documentation

PSMTPClient::PSMTPClient  
 

Create a TCP/IP SMPTP protocol socket channel. The parameterless form creates an unopened socket, the form with the address parameter makes a connection to a remote system, opening the socket. The form with the socket parameter opens the socket to an incoming call from a "listening" socket.

PSMTPClient::~PSMTPClient  
 

Destroy the channel object. This will close the channel and as a client, QUIT from remote SMTP server.


Member Function Documentation

BOOL PSMTPClient::BeginMessage const PString   from,
const PStringList   toList,
BOOL    eightBitMIME = FALSE
 

BOOL PSMTPClient::BeginMessage const PString   from,
const PString   to,
BOOL    eightBitMIME = FALSE
 

Begin transmission of a message using the SMTP socket as a client. This negotiates with the remote server and establishes the protocol state for data transmission. The usual Write() or stream commands may then be used to transmit the data itself.

Returns:
TRUE if message was handled, FALSE if an error occurs.

virtual BOOL PSMTPClient::Close   [virtual]
 

Close the socket, and if connected as a client, QUITs from server.

Returns:
TRUE if the channel was closed and the QUIT accepted by the server.

Reimplemented from PIndirectChannel.

BOOL PSMTPClient::EndMessage  
 

End transmission of a message using the SMTP socket as a client.

Returns:
TRUE if message was accepted by remote server, FALSE if an error occurs.

BOOL PSMTPClient::LogIn const PString   username,
const PString   password
 

Log into the SMTP server using the mailbox and access codes specified. Login is actually attempted only if the server supports SASL authentication and a common method is found

Returns:
TRUE if logged in.

BOOL PSMTPClient::OnOpen   [protected, virtual]
 

This callback is executed when the Open() function is called with open channels. It may be used by descendent channels to do any handshaking required by the protocol that channel embodies.

The default behaviour is to simply return TRUE.

Returns:
Returns TRUE if the protocol handshaking is successful.

Reimplemented from PIndirectChannel.


Member Data Documentation

BOOL PSMTPClient::eightBitMIME [protected]
 

BOOL PSMTPClient::extendedHello [protected]
 

PString PSMTPClient::fromAddress [protected]
 

BOOL PSMTPClient::haveHello [protected]
 

BOOL PSMTPClient::sendingData [protected]
 

PStringList PSMTPClient::toNames [protected]
 


The documentation for this class was generated from the following file:
Generated on Wed Mar 2 19:54:39 2005 for PWLib by doxygen1.2.18