Con las INDY puedes enviar correos de manera bastante sencilla.
Código Delphi
[-]
SMTP: TIdSMTP;
Mail: TIdMessage;
with SMTP do
begin
Host := aHostSmtp ;
UserID := aUserID;
Password := aPassword;
Port := aPort;
SocksInfo.Authentication := saNoAuthentication;
AuthenticationType := atNone;
if aIdentificacion = True then
begin
AuthenticationType := atLogin;
SocksInfo.Authentication := saUsernamePassword;
SocksInfo.Host := aHostSmtp ;
SocksInfo.Password := aPassword;
SocksInfo.Port := aPort;
SocksInfo.UserID := aUserID;
end;
end;
with Mail do
begin
Clear;
UseNowForDate := True;
From.Address := aFromAddress;
From.Name := aFromName;
Organization := aOrganization;
if (EMailAddresses = '') then
raise Exception.Create(_('El destinatario no tiene e-mail...'));
Recipients.EMailAddresses := aEMailAddresses;
Subject := aSubjectMail;
Body.Clear;
Body.Text := 'Hay una factura por firmar';
end;
with SMTP do
begin
try
Connect;
except
Disconnect;
raise Exception.Create(_('Se ha producido un error al intentar la conexión.'));
end;
try
Send(Mail);
except
Disconnect;
raise Exception.Create(_('Se ha producido un error al intentar enviar el mensaje.'));
end;
Disconnect;
end;