SendMailViaSMTP function¶
function SendMailViaSMTP(
srv: string, // IP address or hostname of SMTP server
port: number, // port the SMTP server is listening on
user: string, // username to authenticate to SMTP server
pass: string, // password to authenticate to SMTP server
from: string, // sender (in RFC-822 format)
to: string, // recipient(s) (in RFC-822 format)
subj: string, // subject
body: string, // body of the email
attach: string // full path to a file to be attached
): boolean
The SendMailViaSMTP
function sends an email using the designated SMTP server as a relay.
All parameters are strings, except for the port parameter which is an integer number between 1 and 65536.
Note
The to
parameter may contain multiple recipients, separated by semi-colon (;) as you can see in the example below.
Example:
{
SendMailViaSMTP('smtp.gmail.com', 587, 'me@me.me', GetSecret('smtp pass'),
'me@me.me', 'you@you.com;it@they.com',
'NEW BACKUP UPLOADED!', 'A new backup has been uploaded!'), '');
}