Ver Mensaje Individual
  #1  
Antiguo 09-02-2021
ArtPortEsp ArtPortEsp is offline
Miembro
 
Registrado: may 2018
Ubicación: Mexico
Posts: 152
Reputación: 7
ArtPortEsp Va por buen camino
Email HTML con archivos PDF adjuntos

He estado buscando en internet como poder enviar correos con texto HTML y con archivos adjuntos, pero no he logrado encontrar la solucion, estoy usando Indy 10 y Delphi 7.

hasta el momento he podido:

enviar el correo en texto plano con los archivos PDF (sin problema)
enviar el correo en HTML (pero los archivos PDF se codifican dentro del mismo texto del correo)

encontre esto en internet, pero me da un error "undeclared indentifier TidText"
Cita:
put the HTML in a TIdText object within the TIdMessage.MessageParts collection yourself (don't let TIdMessageClient do it for you), and then set the TIdMessage.ContentType to multipart/related:

Código:
IdMessage.ContentType := 'multipart/related; type="text/html"';
... (Assigning Other Unrelated Properties) ...

T := TIdText.Create(IdMessage.MessageParts, nil);
T.ContentType := 'text/html';
T.Charset := 'utf-8';
T.Body.Text := '<html><body>This is the body of a test email.<p><img src="cid:myimage"></body></html>';

A := TIdAttachmentFile.Create(IdMessage.MessageParts, 'C:\SomeFile.jpg');
A.ContentTransfer := 'base64';
A.ContentType := 'image/jpeg';
A.ContentDisposition := 'inline';
A.ContentID := 'myimage';
Cualquier ayuda será bien recibida!
Responder Con Cita