Title: Send E-Mails with Indy Components (Easy)
Question: What send e-mails with INDY?
Answer:
Hi friends,
Im Emerson Facunte, from Brazil (great Country, intelligent and beautyful people, our country is hot).
ok.ok.
Im going to start a step-by-step description of building a simple program for sending e-mails with Indy Components.
This article is the published in my 6th book of Delphi (see more details in www.facunte.com.br, sorry Portuguese Language only).
Lets go friends.
Start a new project and insert TidSMTP, TIdAntiFreeze and TidMessage, from the Indy Components.
The routine is implemented
procedure TfmeMail.btSendClick(Sender: TObject);
begin
// Config Client
idSMTP1.UserId:=edUser.Text; // TEdit
idSMTP1.Password:=edPass.Text; // TEdit
idSMTP1.Host:=edHost.Text; // TEdit
idSMTP1.Port:=StrtoInt(edPort.Text); // edPort = TEdit
// Atribui o Conteudo do objeto TextodoEmail
// ao objeto PPMensagem
// Connect SMTP Server
idSMTP1.Connect;
try
with MyMessage do // Message = TidMessage
begin
// Config Subject
Subject:=edSubject.Text; // edSubject = TEdit
// Config
From.Text:=edUser_ID.Text; // edUser_ID = TEdit
// Config Recipient
Recipients.EMailAddresses:='put addresses mail for the recipient';
ReceiptRecipient.Address:='put a list of recipient addresses';
// examples
// Recipients.EMailAddresses:='davidi@borland.com';
// ReceiptRecipient.Address:='man1@borland.com;man2@borland.com;emerson@facunte.com.br';
// Config Message
Body.Text:=edMessage.Text; // TMemo
// Send e-mail
idSMTP1.Send(MyMessage);
end; // with MyMessage
finally
// Discconect Server
idSMTP1.Disconnect;
end;
end;
Its all friends.
Sorry, im promisse evolution my english !!!