Board index » delphi » Indy: Sending html mail with attachments

Indy: Sending html mail with attachments

I am able to send HTML mail by setting the idMessage's ContentType to
'text/html' and assigning HTML data to the body. However, adding an
attachment causes the the body to render as plain text instead of HTML.

I'd like to see a code sample of how to send an HTML body with file
attachments.

Thanks,

Steve Kramer

 

Re:Indy: Sending html mail with attachments


g...@goog.com (Borland) wrote in <3a24d609$1_1@dnews>:

Quote
>I am able to send HTML mail by setting the idMessage's ContentType to
>'text/html' and assigning HTML data to the body. However, adding an
>attachment causes the the body to render as plain text instead of HTML.

When sending attachments, you have to send the html as a text part.
Therefor, you have to create two text parts (one plain and one html) and
then the attachments.

--
Hadi Hariri
http://delphi.urusoft.com

Re:Indy: Sending html mail with attachments


Is this possible using the fastnet components that ship with Delphi 5
Enterprise?

I am working on exatly the same thing.

I am trying to send an nice html e-mail with a background and two small
graphics. the rest is text and tables and so is done directly in the html.

I am using an NMSMTP component to send the mail and it only has one body and
then attachments. How do i use that or is there a better method available?

regards,

Allan Burgess

Hadi Hariri - Team Indy <h...@delphihome.com> wrote in message
news:8FFBB3FAEhadidhcom@207.105.83.62...

Quote
> g...@goog.com (Borland) wrote in <3a24d609$1_1@dnews>:

> >I am able to send HTML mail by setting the idMessage's ContentType to
> >'text/html' and assigning HTML data to the body. However, adding an
> >attachment causes the the body to render as plain text instead of HTML.

> When sending attachments, you have to send the html as a text part.
> Therefor, you have to create two text parts (one plain and one html) and
> then the attachments.

> --
> Hadi Hariri
> http://delphi.urusoft.com

Re:Indy: Sending html mail with attachments


Quote
> Is this possible using the fastnet components that ship with Delphi 5
> Enterprise?

I wouldn't recommend that. U don't have the code, so u can't see what's
going wrong (and something will go wrong) using those components. Go with
Indy or ICS.

/S{*word*249}

Re:Indy: Sending html mail with attachments


aburg...@bigpond.com (Allan Burgess) wrote in <3a2a069c_1@dnews>:

Quote
>Is this possible using the fastnet components that ship with Delphi 5
>Enterprise?

Not recommened.

Quote
>I am working on exatly the same thing.

>I am trying to send an nice html e-mail with a background and two small
>graphics. the rest is text and tables and so is done directly in the
>html.

Just send the background and any other inline image as attachments setting
the content-disposition to inline.

Other Threads