TSMTP

Navigation:  Les scripts > Les autres scripts > Procedure and function > Specifics > Objects >

TSMTP

Previous pageReturn to chapter overviewNext page

TSmpt.Smtpcreate;

 

Constructor SmtpCreate;

 

The TSMTP component enables the sending of E-Mail via an internet mail server and the implementation of other commands specified in RFC 821.

 

TSmtp.Free;

 

Procedure Free;

 

The procedure free a prevously created instance of Smpt.

 

TSmtp.Host;

 

Procedure Host(HostName:string);

 

The Host contains the name or dotted IP address of the remote host to connect to.

 

TSmtp.UserId;

 

Procedure UserId(Id:string);

 

The UserID specifies the user name to log into the SMTP host. A UserID is not always necessary to connect to an SMTP host, but many servers will not allow sending of mail without a valid User ID.

 

TSmtp.FromAddress;

 

Procedure FromAddress(s:string);

 

The FromAddress property specifies the E-Mail address of the sender of the message

 

TSmtp.FromName;

 

Procedure FromName(s:string);

 

The FromName property specifies the name of the sender of the E-Mail message.

 

TSmtp.ToAddress;

 

Procedure ToAddress(s:string);

 

The ToAddress property specifies the primary recipients of the E-Mail message to be sent.

 

TSmtp.ToCarbonCopy;

 

Procedure ToCarbonCopy(s:string);

 

The ToCarbonCopy  specifies the list of E-Mail address that will receive carbon copies of the current message.

TSmtp.Subject;

 

Procedure  Subject(s:string);

 

The Subject contains the subject of the E-Mail message to be sent.

TSmtp.BodyText;

 

Procedure BodyText(s:string);

 

The Bodytext contains the body of the E-Mail message to send.

TSmtp.SendMail;

 

Function SendMail:integer;

 

The SendMail method sends the E-Mail message. The returned value is 0 if the message is sended otherwise the result is 1

TSmtp.Result;

 

Function Result:Integer;

 

This function returns the same result  than the sendmail procedure.

 

Exemple:

 

shellexec('RASDial.exe','"Carte ISDN bluewin" username password',SW_SHOW,5000);

M:=SMTPCreate;

M.host('pop.bluewin.ch');

M.UserID:='MyId';

M.Fromaddress:='Test@vkvision.ch';

M.FromName:='Operator';

M.ToAddress:='079443555@sms.bluewin.ch';

M.ToCarbonCopy:='';

M.Bodytext:='Alarme postion 12. Température trop haute (74°C)';

r:=M.sendMail;

if r=0 then print('Ok')

      else print('Erreur');

M.free;

shellexec('RASDial.exe','/disconnect',SW_SHOW,5000);