Anyone know of a good example of generating HTML e-mail with embedded images and an alternate text part? I need to generate some tabular reports in HTML and would like to embed logos and other images.
I believe Indy can do this with some work, but I was hoping someone could point me to a good example as a starting point. I am open to using libraries other than Indy and commercial solutions provided source is available. Quality and time to implement is more important than cost. The solution also needs to support SMTP based delivery to a mail exchanger.
The other item on my wish list is to be able to leverage FastReports, TRichView or similar tool to generate the HTML message content. There are HTML output filters available for both, but I have not had the opportunity to do any testing. Any feedback on this subject would be appreciated.
Thanks in advance!
David
Read the following articles on Indy's website, they explain the proper way to populate a TIdMesaage
for HTML:
HTML Messages
New HTML Message Builder class
These days I use Clever Component's email client, though not free.
The TurboPower Internet (OpenSource) controls worked great for me in the past.
function data64(const filename:string): ansistring;
// uses Classes, IdGlobalProtocols, EncdDecd;
const
crlf = #13#10;
begin
result := '';
with TIdMimeTable.Create do
try
result := 'data:'
+ GetFileMIMEType(filename) + ';';
finally
Free;
end;
with TMemoryStream.Create do
try
LoadFromFile(filename);
result := result + 'base64,' + crlf
+ EncodeBase64(Memory,Size);
finally
Free;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With