SYNAPSE - Synchronous TCP/IP Library for Delphi
Other related information can be found at http://www.ararat.cz/synapse/
Class: TSMTPSend
- Properties:
- Timeout:integer
Define timeout in milliseconds for all SMTP operations. Default value is 300 seconds.
- SMTPhost:String
Address of SMTP server (IP address or domain name) where you want to connect.
- ResultCode:integer
result code of last SMTP command.
- ResultString:string
result string of last SMTP command (begin with string representation of result code).
- FullResult:TStringList
All result strings of last SMTP command (result is maybe multiline!).
- ESMTCap:TStringList
List of ESMTP capabilites of remote ESMTP server. (If you connect to ESMTP server!).
- ESMTP:boolean
TRUE if you successfuly logged to ESMTP server.
- Username:String
Username used for authorisation to remote server.
- Password:String
Password used for authorisation to remote server.
- AuthDone:boolean
TRUE if you successfuly pass authorisation to remote server.
- ESMTPSize:boolean
TRUE if remote server can handle SIZE parameter.
- MaxSize:integer
If ESMTPsize is TRUE, contains max length of message that remote server can handle.
- EnhCode1:integer
First digit of Enhanced result code. If last operation does not have enhanced result code, values is 0.
- EnhCode2:integer
Second digit of Enhanced result code. If last operation does not have enhanced result code, values is 0.
- EnhCode3:integer
Third digit of Enhanced result code. If last operation does not have enhanced result code, values is 0.
- Methods:
- Function AuthLogin:Boolean
Provides AUTH command by LOGIN method. It called automaticly by login!
- Function AuthCram:Boolean
Provides AUTH command by CRAM-MD5 method. It called automaticly by login!
- Function Login:Boolean
Connects to SMTP server (defined inSMTPhost) and begin SMTP session. (First try ESMTP EHLO, next HELO handshake). Parses ESMTP capabilites and if you specified Username and password and remote server can handle AUTH command, try login by AUTH command. Preffered login method is CRAM-MD5 (if safer!). If all OK, result is true, else result is false.
- Procedure Logout
Close SMTP session (QUIT command) and disconnect from SMTP server.
- Function Reset:Boolean
Send RSET SMTP command for reset SMTP session. If all OK, result is true, else result is false.
- Function Noop:Boolean
Send NOOP SMTP command for keep SMTP session. If all OK, result is true, else result is false.
- Function mailfrom(Value:string; size:integer):Boolean
Send MAIL FROM SMTP command for set sender e-mail address. If senders e-mail address is empty string, transmited message is error message. If size not 0 and remote server can handle SIZE parameter, append SIZE parameter to request. If all OK, result is true, else result is false.
- Function mailto(Value:string):Boolean
Send RCPT TO SMTP command for set receiver e-mail address. It cannot be an empty string. If all OK, result is true, else result is false.
- Function maildata(Value:Tstrings):Boolean
Send DATA SMTP command and transmit message data. If all OK, result is true, else result is false.
- Function etrn(Value:string):Boolean
Send ETRN SMTP command for start sending remote queue for domain in Value. If all OK, result is true, else result is false.
- Function verify(Value:string):Boolean
Send VRFY SMTP command for check receiver e-mail address. It cannot be an empty string. If all OK, result is true, else result is false.
- Function EnhCodeString:string
Return string descriptive text for enhanced result codes stored in EnhCode1, EnhCode2 and EnhCode3.
- Not class (but cohere) functions:
- Function Sendto (mailfrom,mailto,subject,SMTPHost:string;maildata:TStrings):Boolean
Usefull sample of using TSMTPsend object. Send maildata (text of e-mail without any SMTP headers!) from mailfrom e-mail address to mailto e-mail address (It can be only ONE e-mail address, multiple receivers not supported!) with subject. Function construct all needed SMTP headers (with DATE header) and send e-mail to SMTP server defined in SMTPhost parameter. If e-mail message successfully sended, then result is true.
- Function SendtoRaw (mailfrom,mailto,SMTPHost:string;maildata:TStrings;Username,Password:string):Boolean
Usefull sample of using TSMTPsend object. Send maildata (text of e-mail with SMTP headers!) from mailfrom e-mail address to mailto e-mail address (It can be only ONE e-mail address, multiple receivers not supported!). Function send e-mail to SMTP server defined in SMTPhost parameter. Username and password is used for authorisation to SMTPhost. If you dont wont authorisation, set Username and password to empty string. If e-mail message successfully sended, then result is true.
- Function SendtoEx (mailfrom,mailto,SMTPHost:string;maildata:TStrings;Username,Password:string):Boolean
Usefull sample of using TSMTPsend object. Send maildata (text of e-mail without any SMTP headers!) from mailfrom e-mail address to mailto e-mail address (It can be only ONE e-mail address, multiple receivers not supported!). Function send e-mail to SMTP server defined in SMTPhost parameter. Username and password is used for authorisation to SMTPhost. If you dont wont authorisation, set Username and password to empty string. If e-mail message successfully sended, then result is true.