class PSMTPServer |
A TCP/IP socket for the Simple Mail Transfer Protocol.
![]() | OnUnknown ( const PCaselessString & command ) Handle an unknown command. |
![]() | OnTextData (PCharArray & buffer, BOOL & completed) Read a standard text message that is being received by the socket. |
![]() | OnMIMEData (PCharArray & buffer, BOOL & completed) Read an eight bit MIME message that is being received by the socket. |
Construction
Overrides from class PObject
Overrides from class PChannel
Channel establish functions
Information functions
Reading functions
Writing functions
Miscellaneous functions
Error functions
Run Time Type functions
I/O functions
Comparison functions
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: <PRE><CODE> 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; </PRE></CODE>
When acting as a server, a descendant class would be created to override at least the <A>LookUpName()</A> and <A>HandleMessage()</A> functions. Other functions may be overridden for further enhancement to the sockets capabilities, but these two will give a basic SMTP server functionality.
The server socket thread would continuously call the <A>ProcessMessage()</A> function until it returns FALSE. This will then call the appropriate virtual function on parsing the SMTP protocol.
The default behaviour is to read the data into the <CODE>buffer</CODE> parameter until either the end of the message or when the <CODE>messageBufferSize</CODE> bytes have been read.
The default behaviour is to read the data into the <CODE>buffer</CODE> parameter until either the end of the message or when the <CODE>messageBufferSize</CODE> bytes have been read.
Alphabetic index HTML hierarchy of classes or Java