Después de unas horas batallando me di por vencido con las INDY y opte por Synapse.
Código Delphi
[-]uses
SMTPSend, MIMEPart, MIMEMess;
procedure TForm.SendEmailClick(Sender: TObject);
var
MIMEText: TStrings;
MIMEPart: TMimePart;
MIMEMessage: TMimeMess;
begin
MIMEText := TStringList.Create;
MIMEText.Add('Hello,');
MIMEText.Add('here is the text of your e-mail message,');
MIMEText.Add('if you want the HTML format, use AddPartHTML');
MIMEText.Add('or e.g. AddPartHTMLFromFile if you have your');
MIMEText.Add('HTML message content in a file.');
MIMEMessage := TMimeMess.Create;
with MIMEMessage do
try
Header.Date := Now;
Header.From := 'sender@from.com';
Header.ToList.Clear;
Header.ToList.Add('recipient@to.com');
Header.CcList.Clear;
Header.Subject := 'E-mail subject';
Header.XMailer := 'My mail client name';
MIMEPart := AddPartMultipart('mixed', nil);
AddPartText(MIMEText, MIMEPart);
AddPartBinaryFromFile('c:\voucher.pdf', MIMEPart);
EncodeMessage;
if SendToRaw(Header.From, Header.ToList.CommaText, 'smtp.server.com', Lines, 'login', 'password') then
ShowMessage('E-mail has been successfuly sent ')
else
ShowMessage('E-mail sending failed ');
finally
Free;
MIMEText.Free;
end;
end;
Añadiendo las librerías y con las modificaciones para adaptarlo a mis necesidades, va perfecto ese código.
Lo encontré aquí:
http://stackoverflow.com/questions/6...lient-agnostic