#include <inetmail.h>
Inheritance diagram for PSMTPClient:
Public Member Functions | |
PSMTPClient () | |
~PSMTPClient () | |
virtual PBoolean | Close () |
PBoolean | LogIn (const PString &username, const PString &password) |
PBoolean | BeginMessage (const PString &from, const PString &to, PBoolean eightBitMIME=PFalse) |
PBoolean | BeginMessage (const PString &from, const PStringList &toList, PBoolean eightBitMIME=PFalse) |
PBoolean | EndMessage () |
Protected Member Functions | |
PBoolean | OnOpen () |
Protected Attributes | |
PBoolean | haveHello |
PBoolean | extendedHello |
PBoolean | eightBitMIME |
PString | fromAddress |
PStringList | toNames |
PBoolean | sendingData |
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;
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.
PBoolean PSMTPClient::BeginMessage | ( | const PString & | from, | |
const PStringList & | toList, | |||
PBoolean | eightBitMIME = PFalse | |||
) |
from | User name of sender. |
toList | List of user names of recipients. |
eightBitMIME | Mesage will be 8 bit MIME. |
PBoolean PSMTPClient::BeginMessage | ( | const PString & | from, | |
const PString & | to, | |||
PBoolean | eightBitMIME = PFalse | |||
) |
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.
from | User name of sender. |
to | User name of recipient. |
eightBitMIME | Mesage will be 8 bit MIME. |
virtual PBoolean PSMTPClient::Close | ( | ) | [virtual] |
Close the socket, and if connected as a client, QUITs from server.
Reimplemented from PIndirectChannel.
PBoolean PSMTPClient::EndMessage | ( | ) |
End transmission of a message using the SMTP socket as a client.
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
username | User name on remote system. |
password | Password for user name. |
PBoolean 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 PTrue.
Reimplemented from PIndirectChannel.
PBoolean PSMTPClient::eightBitMIME [protected] |
PBoolean PSMTPClient::extendedHello [protected] |
PString PSMTPClient::fromAddress [protected] |
PBoolean PSMTPClient::haveHello [protected] |
PBoolean PSMTPClient::sendingData [protected] |
PStringList PSMTPClient::toNames [protected] |