Que tal Angel,
Te mando una funcion de como lo hago (solo que uso Indy 9.014), espero te ayude.
Código Delphi
[-]bool __fastcall TFrmMail::EnviaMail()
BodyLines = new TStringList();
ModuloDeDatos->LlenaListas(ListaPara,CorreoDestino,false);
ModuloDeDatos->LlenaListas(ListaCC,CC,false);
ModuloDeDatos->LlenaListas(ListaBCC,BCC,false);
SMTP->Username = UserID;
SMTP->Password = Password;
SMTP->Host = Host;
SMTP->Port = Port;
SMTP->AuthenticationType = atLogin;
if(UsaSTARTTLS)
if(UsaSSL)
SMTP->IOHandler=SSL;
Mensaje = new TIdMessage(NULL);
Mensaje->Clear();
Mensaje->ContentType = "multipart/mixed";
Mensaje->From->Name = FromName;
Mensaje->From->Address = FromAddress;
Mensaje->Subject = Subject;
BodyIndyText = new TIdText(Mensaje->MessageParts,NULL);
BodyIndyText->ContentType="text/plain";
BodyIndyText->Body->Text="";
if(Admin)
BodyLines->Add(Body);
else
BodyIndyHtml = new TIdText(Mensaje->MessageParts,BodyLines);
BodyIndyHtml->ContentType="text/html";
BodyIndyHtml->Body->Clear();
BodyIndyHtml->Body->Add(Body);
if(FileExists(Logo))
while(i< ListaCC->Count)
while(i< ListaBCC->Count)
i=0;
while(i< ListaPara->Count)
if(FileExists(Attach1))
IndyAttach1 = new TIdAttachment( Mensaje->MessageParts, Attach1 );
if(FileExists(Attach2))
IndyAttach2 = new TIdAttachment( Mensaje->MessageParts, Attach2);
while(Intento < 2)
Intento=2;
PuedeCerrar=true;
}
catch(Exception &e)
else
Intento++;
PuedeCerrar=false;
}
}
__finally
}
}
return Que;
}