tags:

views:

195

answers:

2

I am making an application in Delphi 7 and I need to send an email using PageProducer component in order to make it in HTML format. At this point, the objective is to send the email in both formats: text/plain and text/html, but really know how to send it in only one format: either text/plain or text/html. So, how to send an email using PageProducer in both formats: plain and HTML??

I need that because there are webmail servers that don't accept HTML emails.

Note: I am sorry about my English.

Thanks.

+3  A: 

Hi,

PageProducer is just a component for producing HTML content by replacing some tags with your specified content. It has no feature for sending emails.

To send email in Delphi 7, you can use IdSMTP component from Indy Clients tab in Components Palette. As it is clear from its name, this component uses SMTP protocol for sending emails.

In your case, you should first generate HTML content using either PageProducer or any other method, and then pass the HTML content to IdSMTP to be sent as an email.

To send an email in both plain text and HTML format you should use multi-part message. You can refer to Indy help for TIdMessage class.

Regards

vcldeveloper
OK, that's what I am doing... using IdSMTP, etc, etc... But the email I send takes either text/plain or text/html formay, not both...
Yanier
As I mentioned, you need to send it as multi-part message. IdSmtp.Send method accepts a TIdMessage instance. TIdMessage class has a MessageParts property. You should add a message part for text/plain, and a message part for text/html.
vcldeveloper
+2  A: 

You should take a look at the MIME format. This is the format the email is finally sent.

If you understand it you will be able to send Multipart messgaes containing text/plain text/html or attachments. http://en.wikipedia.org/wiki/MIME

Daniel Luyo