Class: TSMTPSend
RFC: 821, 1870, 1893, 1985, 2034, 2104, 2195, 2554
Features:
{you must create object for SMTP session}
SMTP:=TSMTPSend.Create;
try
{set address of SMTP server, throw you can send e-mails}
SMTP.SMTPHost:=SMTPHost;
{begin SMTP session with server}
if not SMTP.login then
{error connecting to server}
;
{send e-mail address of sender.}
if not SMTP.mailfrom(EMailOfSender,0) then
{server not allow e-mails from this sender}
;
{send e-mail address of receiver. You may run this line multiply, if e-mail for multiple receivers}
if not SMTP.mailto(EMailOfFirstReceiver) then
{server not allow send e-mail to this receiver from sender address}
;
if not SMTP.mailto(EMailOfSecondFirstReceiver) then
{server not allow send e-mail to this receiver from sender address}
;
//...etc...
{now send raw data of e-mail stored as text in Stringlist.}
{Remember, text data must have headers lines. Practical headers is FROM, TO, DATE and SUBJECT}
{If you can send MIME e-mails, you must code it to stringlist first}
if not SMTP.maildata(t) then
{this e-mail body is not accepted}
;
{closing session and disconnect from SMTP server}
SMTP.logout;
finally
{destroy SMTP object}
SMTP.Free;
end;