Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   Email HTML con archivos PDF adjuntos (https://www.clubdelphi.com/foros/showthread.php?t=95060)

ArtPortEsp 09-02-2021 19:03:46

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!

ArtPortEsp 09-02-2021 19:22:38

y ya busque en mi maquina la unidad IdText.pas y no esta...

Garada 09-02-2021 22:36:12

Si los Indy están actualizados tienen un constructor para los mensajes que facilita el proceso:
https://www.indyproject.org/2008/01/...builder-class/

ArtPortEsp 10-02-2021 22:38:00

Cita:

Empezado por Garada (Mensaje 539968)
Si los Indy están actualizados tienen un constructor para los mensajes que facilita el proceso:
https://www.indyproject.org/2008/01/...builder-class/

Gracias Garada!


La franja horaria es GMT +2. Ahora son las 08:33:53.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi