Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

e-mail within my application

Status
Not open for further replies.

yomyom

Programmer
Dec 23, 2002
119
GB
Hello,
Can I send an e-mail from within my delphi 4 application? If so how?
yomyom
 
Yes you can.
You can send it via NMSMTP(delphi5) or IDSMTP(delphi6 and delphi7)

delphi5:
an exemple:

procedure envMsg(msgFrom, msgTo : string);
var
sj : string;
sl : TStringList;
begin

//msgFrom - sender
//msgTo - destination

sj := YourSubject
sl := TStringList.Create;
sl.Add(dmp.tMsg.fieldByName('Body').asString);

SMTPenvMsg.Host := YourHost(ex: 10.10.10.10);
SMTPenvMsg.Port := Port (ex:25);

try

if SMTPenvMsg.Connected=false then
SMTPenvMsg.Connect;
SMTPenvMsg.PostMessage.FromAddress := msgFrom;
SMTPENVmSG.PostMessage.ToAddress.Add(msgTo);
SMTPenvMsg.PostMessage.Subject := sj;
SMTPenvMsg.PostMessage.Body.Assign(sl);
SMTPenvMsg.SendMail;
sl.Free;
finally
SMTPenvMsg.Disconnect;
end;

Hope it helps you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top