TSyncSmtpCli Last Updated: 10/01/2001 |
TSyncSmtpCli class adds synchronous functions to the TSmtpCli class, which implements the SMTP protocol (RFC-821) used to send e-mail.
Here are the sections available for the TSyncSmtpCli:
- [ Properties ]
- [ Events ]
- [ Methods ]
- [ Globals ]
- [ Notes ]
Below is the full description for all the sections in the TSyncSmtpCli:
Below is a list of all Properties for use as a quick reference:
Below is a list of all Properties with their complete descriptions:
AuthType: | property AuthType: TSmtpAuthType; Specifies what type of SMTP authentication will be used. The default value is smtpAuthNone (no authentication). This property is used by the AuthSync() method. The supported authentication types are: smtpAuthNone, smtpAuthPlain, smtpAuthLogin, smtpAuthCramMD5. |
[Return to Top] | |
CharSet: | property CharSet: String; Specifies what character set will be used in the mail message. This is a compliment to the ContentType property. The default is ISO-8859-1. |
[Return to Top] | |
Connected: | property Connected: Boolean; Specifies if there is currently an active connection to the SMTP server. |
[Return to Top] | |
ContentType: | property ContentType: TSmtpContentType; Specifies the MIME-type of the content within the message. It can be either smtpPlainText (MIME-Type text/plain) or smtpHTML (MIME-Type text/html). The default is smtpPlainText (text/plain). If you change this property after calling the component constructor, you must call the SetContentType() method. |
[Return to Top] | |
EmailFiles: | property EmailFiles: TStrings; Specifies a list of filenames to be sent as MIME attachments with the e-mail. |
[Return to Top] | |
ErrorMessage: | property ErrorMessage: String; Contains the string of the last error that occurred. |
[Return to Top] | |
FromName: | property FromName: String; Specifies the e-mail address of the sender. This property will be used for the e-mail envelope (required by the SMTP server) and it will not be included in the message headers. This is the e-mail address to which the server will return the message if it could not be delivered. |
[Return to Top] | |
HdrFrom: | property HdrFrom: String; Specifies the 'From:' header of the message. This is the address that the recipient will see as the sender. Note: For more information about the message headers, refer to RFC-822. |
[Return to Top] | |
HdrReplyTo: | property HdrReplyTo: String; Specifies the 'Reply-To:' header of the message. This is the address to which replies by the recipient(s) will be sent. Note: For more information about the message headers, refer to RFC-822. |
[Return to Top] | |
HdrReturnPath: | property HdrReturnPath: String; Specifies the 'Return-Path:' header of the message. This header is supposed to be added by the final transport system that delivers the e-mail and is intended to identify a path back to the sender in case of problems. Do not confuse this with the 'Reply-To:' header which is intended to direct replies. Note: For more information about the message headers, refer to RFC-822. |
[Return to Top] | |
HdrSender: | property HdrSender: String; Specifies the 'Sender:' header of the message. It is intended for use when the sender is not the author of the message. The default is the string specified in the HdrFrom property. Note: For more information about the message headers, refer to RFC-822. |
[Return to Top] | |
HdrSubject: | property HdrSubject: String; Specifies the 'Subject:' header of the message. Note: For more information about the message headers, refer to RFC-822. |
[Return to Top] | |
HdrTo: | property HdrTo: String; Specifies the 'To:' header of the message. It is not necessarily the recipient of the message. Note: For more information about the message headers, refer to RFC-822. |
[Return to Top] | |
Host: | property Host: String; The SMTP Server to which you want to connect. |
[Return to Top] | |
LastResponse: | property LastResponse: String; The server response from the most recent command request. |
[Return to Top] | |
LocalAddr: | property LocalAddr: String; Can be a dotted IP address, or a hostname. Preferable is a dotted IP address. For a client it is the machine to connect to, and for a server it is the interface to listen on if it is a multihomed computer. Default value for a server is '0.0.0.0'. |
[Return to Top] | |
MailMessage: | property MailMessage: TStrings; Specifies the body of the e-mail message. |
[Return to Top] | |
MultiThreaded: | property MultiThreaded: Boolean; Set this to true if you use TSyncSmtpCli in a thread. Note it has nothing to do with multiple sockets. |
[Return to Top] | |
OwnHeaders: | property OwnHeaders: Boolean; This property indicates whether the message contains its own set of headers. If OwnHeaders is set to True, the component will not add any headers to the message when sending. This is useful for relaying e-mail between SMTP servers, where the message itself already contains its own headers. |
[Return to Top] | |
Password: | property Password: String; The password used to authenticate with the SMTP server. This property is used by the AuthSync() method. |
[Return to Top] | |
Port: | property Port: String; The tcp port of the SMTP server to which you want to connect. The default is 'smtp'. |
[Return to Top] | |
RcptName: | property RcptName: TStrings; Specifies a list of e-mail addresses to which the message will be delivered. This property will be used for the e-mail envelope (required by the SMTP server) and represents the actual recipient(s) of the message. None of the addresses in this list will be included in the message headers. |
[Return to Top] | |
SignOn: | property SignOn: String; Specifies the domain of the sender, required by the SMTP server for identification in order to start an SMTP session. This property is used by the HeloSync() and EhloSync() methods. |
[Return to Top] | |
State: | property State: TSmtpState; The current state of the component. It can be any of the following: smtpReady, smtpDnsLookup, smtpConnecting, smtpConnected, smtpInternalReady, smtpWaitingBanner, smtpWaitingResponse, smtpAbort. |
[Return to Top] | |
Timeout: | property Timeout: Integer; This is the amount of time in seconds the component will wait for a response from the server before the request fails. The default is 15 seconds. Set this to 0 for no timeout. |
[Return to Top] | |
Username: | property Username: String; The Username used to authenticate with the SMTP server. This property is used by the AuthSync() method. |
[Return to Top] | |
Below is a list of all Events for use as a quick reference:
Below is a list of all Events with their complete descriptions:
OnAttachContentType: | property OnAttachContentType: TSmtpAttachmentContentType; When the DataSync() method is called and the message contains file attachments, this event is fired before each file is attached (when the MIME headers are sent). |
[Return to Top] | |
OnAttachHeader: | property OnAttachHeader: TSmtpAttachHeader; When the DataSync() method is called and the message contains file attachments, this event is fired after the MIME headers for each file is sent. |
[Return to Top] | |
OnCommand: | property OnCommand: TSmtpDisplay; This event is fired right after an SMTP command is sent to the server. |
[Return to Top] | |
OnDisplay: | property OnDisplay: TSmtpDisplay; This event is fired whenever a command is sent or a response is received. This is mainly used to trace or log the SMTP transaction with the server while debugging. |
[Return to Top] | |
OnGetData: | property OnGetData: TSmtpGetDataEvent; When the DataSync() method is called, this event is fired before sending each line of the message body, including the headers. |
[Return to Top] | |
OnHeaderLine: | property OnHeaderLine: TSmtpHeaderLineEvent; When the DataSync() method is called, this event is fired after each header line is sent to the SMTP server. This is useful to intercept the headers and add your own. |
[Return to Top] | |
OnProcessHeader: | property OnProcessHeader: TSmtpProcessHeaderEvent; When the DataSync() method is called, this event is fired when all the headers have been sent to the server. |
[Return to Top] | |
OnRequestDone: | property OnRequestDone: TSmtpRequestDone; This event is fired after a request to the SMTP server has finished and a response has been received, even if the request failed. |
[Return to Top] | |
OnResponse: | property OnResponse: TSmtpDisplay; This event is fired every time a response is received from the SMTP server as a consequence to an SMTP command. |
[Return to Top] | |
OnSessionClosed: | property OnSessionClosed: TSessionClosed; This event is fired when the SMTP session is closed and the connection to the server is dropped due to a QuitSync() or AbortSync() method call. |
[Return to Top] | |
OnSessionConnected: | property OnSessionConnected: TSessionConnected; This event is fired when a connection to the SMTP server is established and the SMTP session starts after a ConnectSync() or OpenSync() method call (when the welcome banner is received). In the case of the OpenSync() method, OnSessionConnected is fired after the connection is established but before the HELO/EHLO command is sent. |
[Return to Top] | |
Below is a list of all Methods for use as a quick reference:
Below is a list of all Methods with their complete descriptions:
AbortSync: | function AbortSync: Boolean; Aborts the current operation and closes the connection. This is a quick and dirty way of closing an SMTP session. |
[Return to Top] | |
AuthSync: | function AuthSync: Boolean; Attempts server authentication using the authentication type specified in the AuthType property. This method requires that you sign on to the server by calling EhloSync() instead of HeloSync(). |
[Return to Top] | |
ConnectSync: | function ConnectSync: Boolean; Connects to the SMTP server. |
[Return to Top] | |
DataSync: | function DataSync: Boolean; Submits the message to the SMTP server, including all headers. If the EmailFiles property contains any filenames, they are first encoded using Base64 and sent along with the message. |
[Return to Top] | |
EhloSync: | function EhloSync: Boolean; Alternative to the HeloSync() method for signing on to the SMTP server. This method sends the domain specified in the SignOn property and starts an Extended SMTP (ESMTP) session. If the server supports ESMTP, it will reply with a list of the extensions it supports. |
[Return to Top] | |
HeloSync: | function HeloSync: Boolean; Signs on to the SMTP server to start the SMTP session. This method sends the domain specified in the SignOn property. |
[Return to Top] | |
MailSync: | function MailSync: Boolean; The combination of the MailFromSync(), RcptToSync() and DataSync() methods sent asynchronously in sequence. |
[Return to Top] | |
MailFromSync: | function MailFromSync: Boolean; Submits the e-mail address of the sender required by the SMTP server to create the envelope. The sender's address is read from the FromName property. |
[Return to Top] | |
OpenSync: | function OpenSync: Boolean; The combination of the ConnectSync() and HeloSync() methods sent asynchronously in sequence. If the AuthType property is different than smtpAuthNone then it combines the ConnectSync(), EhloSync() and AuthSync() methods instead. |
[Return to Top] | |
QuitSync: | function QuitSync: Boolean; Closes the SMTP session and disconnects from the server. |
[Return to Top] | |
RcptToSync: | function RcptToSync: Boolean; Submits the list of actual recipients to the SMTP server. |
[Return to Top] | |
RsetSync: | function RsetSync: Boolean; Resets the SMTP session. Any sender or recipient previously specified will be cleared. |
[Return to Top] | |
SetContentType: | procedure SetContentType(newValue: TSmtpContentType); Sets internally the MIME-type of the message body. This method is called automatically when the component is created, but you need to call it manually if you change the ContentType property after that. |
[Return to Top] | |
VrfySync: | function VrfySync: Boolean; Attempts to verify if an e-mail address is valid for delivery by the SMTP server. Note: For security reasons, most SMTP servers disable this command. |
[Return to Top] | |
Below is a list of all Globals for use as a quick reference:
Below is a list of all Globals with their complete descriptions:
Rfc822DateTime: | function Rfc822DateTime(t: TDateTime): String; Converts a TDateTime to a timestamp string as specified in RFC-822. The format of the timestamp is: 'DDD, D MMM YYYY HH:MM:SS TZ'. |
[Return to Top] | |
Below is a list of all Notes for use as a quick reference:
Below is a list of all Notes with their complete descriptions:
Synchronous: | TSyncSmtpCli is derived from the TSmtpCli class and adds synchronous functions. You should avoid using this component because synchronous functions, despite being easy to implement, result in lower performance. |
[Return to Top] | |