Unit smtpcli

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Author: François PIETTE Object: TSMTPClient class implements the SMTP protocol (RFC-821) Support file attachement using MIME format (RFC-1521) EMail: francois.piette@ping.be francois.piette@rtfm.be WebSite: http://www.rtfm.be/fpiette Creation: 09 october 1997 Version: 1.11 Support: Use twsocket@rtfm.be mailing list. See website for details. Legal issues: Copyright (C) 1997 by François PIETTE This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented, you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Updates: Oct 25, 1997 Added the OnHeaderLine event to allow modification/deletion of header lines. Oct 26, 1997 V1.00 Released Changed the OnGetData event arguments to have code compatible between 16 and 32 bit versions (replaced string with PChar). Jan 10, 1998 V1.01 Added a Port property Feb 14, 1998 V1.02 Added an intermeditae TCustomSmtpClient in order to support MIME in the TSmtpClient. I implemented MIME with the help of code donated by Brad Choate Mime is used for file attachement. Added a SetRcptName to copy values from a string list in place of copying the string list reference. Feb 15, 1998 V1.03 Added a CharSet property, defaulting to iso-8859-1 Mar 02, 1998 V1.04 Corrected result for QUIT command. Marcus Schmutz Mar 06, 1998 V1.05 Use OnDataSent event to prenvent over-buffering Mar 15, 1998 V1.06 Implemented the Date header line Apr 01, 1998 V1.07 Adapted for BCB V3 Apr 10, 1998 V1.08 Corrected DayNames: sunday is day 1, saturday is day 7. Changed UUEncode procedures to virtual methods to ease component inheritance. Apr 26, 1998 V1.09 Ignore any empty file name (a very common error !) Check if file exists and raise an exception if not. Made Rfc822DateTime public. Added Rset method from Victor Garcia Aprea Added Abort procedure to close the socket and abort any operation Made the underlaying TWSocket accessible using a property. Apr 28, 1998 V1.10 Reset FTimeOutFlag in the mail procedure. May 05, 1998 V1.11 Handled correctly lines beginning with a dot. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Classes

TCustomSmtpClient - Base component, implementing the transport, without MIME support
TSmtpClient - Descending component adding MIME (file attach) support

Functions

Register - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Rfc822DateTime - Function to convert a TDateTime to an RFC822 timestamp string

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Types

TSmtpDisplay
TSmtpGetDataEvent
TSmtpHeaderLineEvent
TSmtpProcessHeaderEvent
TSmtpState

Constants

SmtpCliVersion

Variables


Functions


procedure Register;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function Rfc822DateTime(t : TDateTime) : String;

Function to convert a TDateTime to an RFC822 timestamp string

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Types


TSmtpDisplay            = procedure(Sender  : TObject;
                                        Msg     : String) of object

TSmtpGetDataEvent       = procedure(Sender  : TObject;
                                        LineNum : Integer;
                                        MsgLine : PChar;
                                        MaxLen  : Integer;
                                        var More: Boolean) of object

TSmtpHeaderLineEvent    = procedure(Sender  : TObject;
                                        Msg     : PChar;
                                        Size    : Integer) of object

TSmtpProcessHeaderEvent = procedure(Sender  : TObject;
                                     HdrLines  : TStrings) of object

TSmtpState    = (smtpDisconnected, smtpConnecting, smtpConnected);

Constants

SmtpCliVersion = 111

Enable partial boolean evaluation } {$T-} { Untyped pointers } {$IFNDEF VER80} { Not for Delphi 1 } {$J+} { Allow typed constant to be modified } {$ENDIF

Variables