|
|
Visits:
4836
(14 on line)
|
Last Update: Dec 5, 2003
|
|
|
|
| | |
| Description Inheritance Example Properties Methods |
| |
| Description |
The non visual TEmail5 Object is used to send Emails using Windows sockets under program control. The TEmail5 object is very powerful and can be used in all kinds of environments without interfering with the installed Email client. For example, when sending an Email under program control with TEmail5 you do not get the MS Outlook dialog box warning you that another application is trying to send an Email as you would if you have Outlook and would try to programmatically send Emails with other programs. The TEmail5 object allows you to attach one or more file attachments to your Emails You can prepare several Emails and send them all at once, or send them one after the other.
See also: TBlatMail5 TCDO5 TMAPI5 TOutlookMail5 Note: TEmail5 is the preferred way for programmatically sending E-mails |
| Description Inheritance Example Properties Methods |
| |
| Inheritance |
Inherits from: TObject5 |
| Description Inheritance Example Properties Methods |
| |
| Example |
| |
'email'Świ'*Create' 'TEmail5'
'email'Świ'Logon'25'smtp.easynet.fr'('eric@lescasse.com' '' 'Eric Lescasse')'Lescasse Consulting'
'email'Świ'to' 'To: ""Eric Lescasse"" ' 'CC: ""Bruno Thevenin"" ' 'BCC: ""Bruno Thevenin"" '
'email'Świ'subject' 'Essai de mail envoyé avec TEmail5'
'email'Świ'message'('Ceci est un E-mail envoyé',Śtcnl,'avec TEmail5, ŕ ętre étudié!')
'email'Świ(›'attachments'),(›'oo5'Świ'installdir'),¨'..\aplwco.dll' '..\apx20ocx.dll'
'email'Świ'Send'
1 0
'email'Świ'to' 'To: ""Eric Lescasse"" ' 'CC: ""Bruno Thevenin"" '
'email'Świ'subject' 'Another E-mail'
'email'Świ'html'1
'email'Świ'message'('Titre ',Śtcnl,Śtclf,'This is a paragraph of text')
'email'Świ'Send'
'email'Świ'LogOff'
'email'Świ'from' 'eric@lescasse.com' © Sender's address
'email'Świ'replyto' 'eric@lescasse.com' © Reply To address (optional)
'email'Świ'name' 'Eric Lescasse' © Sender's Name (optional)
'email'Świ'fromorg' 'Lescasse Consulting' © Sender Organization (optional)
'email'Świ'port'25 © Port to be used (optional: defaults to 25)
'email'Świ'host' 'smtp.easynet.fr' © SMTP server
'email'Świ'Logon' © Logs on SMTP server using above information
'email'Świ'to' 'To: ""Eric Lescasse"" ' 'CC: ""Bruno Thevenin"" ' 'BCC: ""Bruno Thevenin"" '
'email'Świ'subject' 'Essai de mail envoyé avec TEmail5'
'email'Świ'message'('Ceci est un E-mail envoyé',Śtcnl,'avec TEmail5, ŕ ętre étudié!')
'email'Świ(›'attachments'),(›'oo5'Świ'installdir'),¨'..\aplwco.dll' '..\apx20ocx.dll'
'email'Świ'Send'
1 0
'email'Świ'LogOff'
'email'Świ'simul'1
'email'Świ'from' 'eric@lescasse.com' © Sender's address
'email'Świ'replyto' 'eric@lescasse.com' © Reply To address (optional)
'email'Świ'name' 'Eric Lescasse' © Sender's Name (optional)
'email'Świ'fromorg' 'Lescasse Consulting' © Sender Organization (optional)
'email'Świ'port'25 © Port to be used (optional: defaults to 25)
'email'Świ'host' 'smtp.easynet.fr' © SMTP server
'email'Świ'Logon' © Logs on SMTP server using above information
'email'Świ'to' 'To: ""Eric Lescasse"" ' 'CC: ""Bruno Thevenin"" ' 'BCC: ""Bruno Thevenin"" '
'email'Świ'subject' 'Essai de mail envoyé avec TEmail5'
'email'Świ'message'('Ceci est un E-mail envoyé',Śtcnl,'avec TEmail5, ŕ ętre étudié!')
'email'Świ(›'attachments'),(›'oo5'Świ'installdir'),¨'..\aplwco.dll' '..\apx20ocx.dll'
'email'Świ'Send'
1 0
'email'Świ'LogOff'
'email'Świ'Close'
|
| |
| Description Inheritance Example Properties Methods |
| |
| Properties |
| |
|
| attachments |
Description: Get or Set the list of file attachments
Syntax: 'obj' Świ 'attachments' {file1 file2...}
file1,file2,...: a nested vector of complete file names
Example:
'em' Świ 'attachments' 'c:\reports\janrep.xls' 'c:\reports\janrep.doc' |
| class |
Description: Return current object class
Syntax: class„'obj' Świ 'class' |
| from |
Description: Get or Set the sender's E-mail address
Syntax: res„'obj' Świ 'from' {fromaddress}
fromaddress: the sender E-mail address
Example:
'em' Świ 'from' 'eric@lescasse.com' |
| fromorg |
Description: Get or Set the sender's organization (not required to send an Email)
Syntax: {organization„'} 'obj' Świ 'fromorg' {organization}
organization: the sender's organization
Example:
'em' Świ 'organization' 'Lescasse Consulting' |
| help |
Example:
0 0˝'email' Świ '*Create' 'TEmail5'
©================================================================================================
'email' Świ 'Logon'25'smtp.easynet.fr' ('eric@lescasse.com' '' 'Eric Lescasse') 'Lescasse Consulting'
© Prepare First Message
'email' Świ 'to' 'To: ""Eric Lescasse"" <eric@lescasse.com>' 'CC: ""Bruno Thevenin"" <eric@lescasse.com>' 'BCC: ""Bruno Thevenin"" <eric@lescasse.com>'
'email' Świ 'subject' 'Essai de mail envoyé avec TEmail5'
'email' Świ 'message' ('Ceci est un E-mail envoyé',Śtcnl,'avec TEmail5, ŕ ętre étudié!')
© 'email' Świ 'attachments' 'c:\filebody.txt' 'd:\aplwin\grid66.bmp' 'd:\aplwin\grid77.bmp'
'email' Świ(›'attachments'),(›'oo5' Świ 'installdir'),¨'..\aplwco.dll' '..\apx20ocx.dll'
'email' Świ 'Send'
© Prepare Second Message
'email' Świ 'to' 'To: ""Eric Lescasse"" <eric@lescasse.com>' 'CC: ""Bruno Thevenin"" <eric@lescasse.com>'
'email' Świ 'subject' 'Another E-mail'
'email' Świ 'html'1
'email' Świ 'message' ('<html><head></head><body><b><font name=""Arial"" size=""6"">Titre</font></b><br>',Śtcnl,Śtclf,'<p><font name=""Arial"">This is a paragraph of text</font></body></html>')
'email' Świ 'Send'
© Logoff and effectively send messages
'email' Świ 'LogOff'
©================================================================================================
© Note: alternatively, you may define Logon parameters separately before calling Logon with no arguments:
'email' Świ 'from' 'eric@lescasse.com' © Sender's address
'email' Świ 'replyto' 'eric@lescasse.com' © Reply To address (optional)
'email' Świ 'name' 'Eric Lescasse' © Sender's Name (optional)
'email' Świ 'fromorg' 'Lescasse Consulting' © Sender Organization (optional)
'email' Świ 'port'25 © Port to be used (optional: defaults to 25)
'email' Świ 'host' 'smtp.easynet.fr' © SMTP server
'email' Świ 'Logon' © Logs on SMTP server using above information
'email' Świ 'to' 'To: ""Eric Lescasse"" <eric@lescasse.com>' 'CC: ""Bruno Thevenin"" <eric@lescasse.com>' 'BCC: ""Bruno Thevenin"" <eric@lescasse.com>'
'email' Świ 'subject' 'Essai de mail envoyé avec TEmail5'
'email' Świ 'message' ('Ceci est un E-mail envoyé',Śtcnl,'avec TEmail5, ŕ ętre étudié!')
© 'email' Świ 'attachments' 'c:\filebody.txt' 'd:\aplwin\grid66.bmp' 'd:\aplwin\grid77.bmp'
'email' Świ(›'attachments'),(›'oo5' Świ 'installdir'),¨'..\aplwco.dll' '..\apx20ocx.dll'
'email' Świ 'Send'
© Logoff and effectively send message
'email' Świ 'LogOff'
©================================================================================================
© Finally, if one wants to see exactly what string is sent to the SMTP Server, without sending the Email
© use the <simul> property
'email' Świ 'simul'1
'email' Świ 'from' 'eric@lescasse.com' © Sender's address
'email' Świ 'replyto' 'eric@lescasse.com' © Reply To address (optional)
'email' Świ 'name' 'Eric Lescasse' © Sender's Name (optional)
'email' Świ 'fromorg' 'Lescasse Consulting' © Sender Organization (optional)
'email' Świ 'port'25 © Port to be used (optional: defaults to 25)
'email' Świ 'host' 'smtp.easynet.fr' © SMTP server
'email' Świ 'Logon' © Logs on SMTP server using above information
'email' Świ 'to' 'To: ""Eric Lescasse"" <eric@lescasse.com>' 'CC: ""Bruno Thevenin"" <eric@lescasse.com>' 'BCC: ""Bruno Thevenin"" <eric@lescasse.com>'
'email' Świ 'subject' 'Essai de mail envoyé avec TEmail5'
'email' Świ 'message' ('Ceci est un E-mail envoyé',Śtcnl,'avec TEmail5, ŕ ętre étudié!')
© 'email' Świ 'attachments' 'c:\filebody.txt' 'd:\aplwin\grid66.bmp' 'd:\aplwin\grid77.bmp'
'email' Świ(›'attachments'),(›'oo5' Świ 'installdir'),¨'..\aplwco.dll' '..\apx20ocx.dll'
'email' Świ 'Send'
© Logoff and do not send the Email but display everything sent to SMTP Server the simul property has been set to 1
'email' Świ 'LogOff'
©================================================================================================
'email' Świ 'Close' |
| host |
Description: Get or Set the SMTP host address
Syntax: {hostaddress„'} 'obj' Świ 'host' {hostaddress}
hostaddress: the sender's SMTP Server address (or IP address)
Example:
'em' Świ 'host' 'smtp.easynet.fr' |
| html |
Description: Indicates whether Email should be sent in HTML format or not
Syntax: {htmlbool„'} 'obj' Świ 'html' {htmlbool}
htmlbook: 1=Email sent ion HTML format, 0 otherwise
Example:
'em' Świ 'html'1 |
| message |
Description: Get or Set the E-mail message
Syntax: res„'obj' Świ 'message' {message}
message: a character string with embedded Śtcnl's representing the message body
Example:
msg„'Hello,',Śtcnl,Śtcnl
msg„msg,'This is the message body!'
'em' Świ 'message'msg |
| name |
Description: Get or Set the Sender's complete name
Syntax: {sendername„'} 'obj' Świ 'name' {sendername}
sendername: the complete name of the Email message sender
Example:
'em' Świ 'name' 'Eric Lescasse' |
| port |
Description: Get or Set the TCP/IP Port to be used
Syntax: {portnumber„'} 'obj' Świ 'port' {portnumber}
portnumber: a port number (defaults to 25 if not used)
Example:
'em' Świ 'port'26 |
| replyto |
Description: Get or Set the Sender's reply Email address
Syntax: {replyaddr„'} 'obj' Świ 'replyto' {replyaddr}
repplyaddr: the Email address to which a reply is requested
Example:
'em' Świ 'replyto' 'lescasse@hotmail.com' |
| simul |
Description: Allows to simulate Email sending and to see exactly what's sent to the SMTP server
Syntax: {simulbool„'} 'obj' Świ 'simul' {simulbool}
simulbool: 1=simulate email sending, 0=(default) send emails
Example:
'em' Świ 'simul'1 |
| subject |
Description: Get or Set the E-mail message subject
Syntax: {subject„'} 'obj' Świ 'subject' {subject}
subject: a character string with no ŚTCNL or ŚTCLF
Example:
'em' Świ 'subject' 'Re: Holidays' |
| to |
Description: A matrix or vector of vectors with the addresses of the recipients
Syntax: {to„'} 'obj' Świ 'to' {to}
to: a character vector or a nested vector of character vectors
e.g. 'To: <Eric@Lescasse.com>' or 'CC: <bruno@thevenin.com>'
or: 'To: ""Eric Lescasse"" <Eric@Lescasse.com>' 'CC: ""Bruno Thévenin"" <bruno@thevenin.com>'
Addresses must start with To: CC: or BCC: followed by a blank.
NOTE: a maximum of 100 addresses is supported!
Example:
'em' Świ 'to' 'To: ""Eric Lescasse"" <Eric@Lescasse.com>' 'CC: ""Bruno Thévenin"" <bruno@thevenin.com>' |
|
| Description Inheritance Example Properties Methods |
| |
| Methods |
| |
|
| Addr |
Description: Extract the first Email address contained in a string
Syntax: emailaddr„'obj' Świ 'Addr'address
address: a character string containing an Email address
emailaddr: the Email address extracted from address
Example:
'em' Świ 'Addr' 'To: ""Eric Lescasse"" <Eric@Lescasse.com>' |
| Base64Encode |
Description: Encode messages into Base64 (MIME)
Syntax: encodedstr„'obj' Świ 'Base64Encode'filename
filename: a complete file name
Note: description of the Base64 algorithm
The purpose of the base64 algorithm is to convert all 256 characters
of the character set into the 64 characters shown below, as those
characters are common on all possible machines through wich a mail
message can pass on it's way through the Internet.
To do this, every 24 bits (3 8-bit characters) are split into 4 6-bit
chunks (=24 bits again). Those 6-bit chunks are used as an index into
the base64 alfabet. If the message does not contain a number of
characters divisible by 3, "=" characters are appended as padding after
encoding, to help the decoding function do it's work.
Example:
'em' Świ 'Base64Encode' 'c:\aplwin40\aplw.ini' |
| Boundary |
Description: Create a unique boundary designator (to separate mail text from attachements)
Syntax: boundary„'obj' Świ 'Boundary'
Example:
'em' Świ 'Boundary'
------2003000200100020001100410414.APLWIN |
| Cmd |
Description: Send a command to an SMTP server
Syntax: res„'obj' Świ 'Cmd'command arg1 arg2...
command: one of: Socket, Connect, Send, Recv
arg1, arg2, ...: command arguments
Example:
'em' Świ 'Cmd' 'Socket'
'em' Świ 'Cmd' 'Connect'25'smtp.easynet.fr'
'em' Świ 'Cmd' 'Recv' 'char'
'em' Świ 'Cmd' 'Send' ('HELO lescasse.com',Śtcnl,Śtclf) 'char'
'em' Świ 'Cmd' 'Recv' 'char' |
 |
| DefaultSMTPAccount |
Description: Returns the default SMTP account for the current user
Syntax: smtpacc„'obj' Świ 'DefaultSMTPAccount'
Example:
'email' Świ 'DefaultSMTPAccount'
smtp.easynet.fr
Note: requires TRegistry5 |
| LogOff |
Description: Log out from an SMTP mail server and send pending Emails
Syntax: answer„'obj' Świ 'LogOff'
answer: the answer from the server, or an error text
Positive answers from the server start with the
characters '250 ', errors start with '4xx' or '5xx'
Note: Mails will not really be sent before this command has completed
Example:
'em' Świ 'LogOff' |
| Logon |
Description: Log on to an SMTP mail server
Syntax: 'obj' Świ 'Logon'port server (from {replyto} {name}) fromorg
port: the port number of the mailserver, usually 25
server: name or IP address of the mail server
from: the user mail-id and domain (example: eric@lescasse.com)
replyto: (optional) the reply to address (example: eric@lescasse.com)
name: (optional) the real user name (example: Eric Lescasse)
fromorg: (optional) the user's organisation (example: Lescasse Consulting)
Example:
'em' Świ 'Logon'25'smtp.easynet.fr' ('eric@lescasse.com' 'eric@lescasse.com' 'Eric Lescasse') 'Lescasse Consulting' |
| New |
Description: Create a new instance of TEmail5
Example:
'obj' Świ '*Create' 'TEmail5'
|
| Send |
Description: Sends the Email defined by previously set properties
Syntax: 'obj' Świ 'Send'
Example:
'em' Świ 'Send' |
| Stuff |
Description: Convert a text matrix to a vector with embedded cr/lf plus dot-stuffing
Syntax: rc„'obj' Świ 'Stuff'len mat
len: the maximum line length, excluding cr/lf line ends. Defaults to 72,
as 74 is a safe line length to transmit through SMTP
mat: a text matrix or vector intended to be sent as mail through SMTP
rc: a string with cr/lf every len characters and dot-stuffing
Note: It is safe to send a Base64-encoded string through this function,
as those strings do not contain any dots. However, the function does
not work well if there are cr/lf already present in the input.
Dot-Stuffing: The end of an SMTP mail text is indicated by transmitting
a line with a single dot. This means, that the original
mail text must not contain a single dot on a line by itself.
To prevent this, every line that starts with a dot get's
preceeded with a second dot, which will be removed by the
recipients mail client. See pop3_unstuff, the reverse function. |
| TimeStamp |
Description: Returns an internet-conform timestamp
Syntax: 'obj' Świ 'TimeStamp'
Example:
'em' Świ 'TimeStamp' |
| Validate |
Description: Return 1 if argument is a valid Email address |
|
| Description Inheritance Example Properties Methods |
| |
|