Por si estuviera algo mal voy a poner como tengo configurado los componentes
y este es el código que estoy usando
Código Delphi
[-] with IdMessage do
begin
Body.Clear();
Recipients.Clear();
Sender.Address := xxxxx@gmail.com';
Recipients.EMailAddresses := xxx@xxx.es';
Subject := edit2.Text; El asunto
Body.AddStrings(Memo1.Lines);
Adjunto:=Edit3.Text+Edit4.Text;
ShowMessage('['+Adjunto+']');
if FileExists(Adjunto) then
with TIdAttachmentFile.Create(MessageParts,Adjunto) do
begin
ContentType := 'binary';
end
end;
with IdSMTP do
begin
IOHandler := IdSSLIOHandlerSocketOpenSSL1;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method := sslvSSLv23; IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Mode := sslmUnassigned;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.VerifyMode := [];
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.VerifyDepth := 0;
Port := 465;
Host := 'smtp.gmail.com';
AuthType := satDefault;
Username := 'xxxxxxx@gmail.com';
Password := 'xxxxxxxx';
try
Connect;
except
raise Exception.Create('Error de Conexión');
end;
if Connected then
Disconnect();
end;