471,314 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,314 software developers and data experts.

Emailing HTML and attachments

Hi,

I am sending an email in my .NET2.0 web app using:
System.Net.Mail.Attachment
System.Net.Mail.MailMessage

I can successfully send an HTML email with a background image, however
that image shows up as an attachment in the target email box.

If its possible, I would like to send HTML formatted emails where the
images don't all appear as attachments. I am guessing its something to
do with the way I am attaching my files; currently i only create a new
instance of the Attachment class, and add it to my MailMessage. Nothing
else.

Any hints?

Steve

Feb 14 '06 #1
5 1861
Steven Nagy wrote:
Hi,

I am sending an email in my .NET2.0 web app using:
System.Net.Mail.Attachment
System.Net.Mail.MailMessage

I can successfully send an HTML email with a background image, however
that image shows up as an attachment in the target email box.

If its possible, I would like to send HTML formatted emails where the
images don't all appear as attachments. I am guessing its something to
do with the way I am attaching my files; currently i only create a new
instance of the Attachment class, and add it to my MailMessage.
Nothing else.


html emails with graphics are send using mime-types, but it's
cumbersome. The main thing is that an image in a HTML email IS an
attachment, the emailreader simply sees it as part of the email, that
is.. it depends on the settings of the emailreader. So if I were you,
I'd store the images on a server somewhere and use <img
src="yourserver\image.jpg"> tags in the email instead.

FB

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Feb 14 '06 #2
> Steven Nagy wrote:
Hi,

I am sending an email in my .NET2.0 web app using:
System.Net.Mail.Attachment
System.Net.Mail.MailMessage

I can successfully send an HTML email with a background image, however
that image shows up as an attachment in the target email box.

If its possible, I would like to send HTML formatted emails where the
images don't all appear as attachments. I am guessing its something to
do with the way I am attaching my files; currently i only create a new
instance of the Attachment class, and add it to my MailMessage.
Nothing else.


html emails with graphics are send using mime-types, but it's
cumbersome. The main thing is that an image in a HTML email IS an
attachment, the emailreader simply sees it as part of the email, that
is.. it depends on the settings of the emailreader. So if I were you,
I'd store the images on a server somewhere and use <img
src="yourserver\image.jpg"> tags in the email instead.

FB


BUT this will lead to warnings like "to protect your privacy, you will
have to do extra actions to show the images".

It should be possible using the "LinkedResource" class (System.Net.Mail
namespace) to refer directly to an attached image.
Sorry, I don't have experience with this (yet), so I can't help you
further.

Hans Kesting
Feb 14 '06 #3
We don't want the chances of an email rendering based on whether or not
they can see the server or not. This is email that goes to general
public and the server may not be accessible to them as such.

I know it can be done, because whenever I get spam about buying viagra,
the images aren't appearing in the attachment list with the email, even
though they must be attachments. So there must be a flag somewhere to
set.

Also as Hans says, you don't want them getting prompts as well.

Thanks Hans and Frans!

Feb 14 '06 #4
You will always run into this issue when sending HTML formatted with
images. The only way I know around it is if you use the absolute web
address. e.g http://. Then, you run into the issue like you said where
the user has to do a little extra to see the images or spam filtering
may even reject these emails.. To be honest with you. I don't know if
there is a way around that. If there is, then I would certainly like
to know.

This is why most people resort to plain text emails since its the most
safe.

Feb 14 '06 #5
I'm using Linked resources under 2.0 and I noticed a similar problem when
using embedded graphics, - these work OK within Outlook although they are
treated as YAhoo attachments..

Did you find any way around this issue.
Jul 30 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Bill | last post: by
1 post views Thread by Bob-O | last post: by
4 posts views Thread by Farooq Khan | last post: by
4 posts views Thread by MW de Jager | last post: by
1 post views Thread by Will | last post: by
3 posts views Thread by dee | last post: by
1 post views Thread by =?Utf-8?B?U2FpIFZhamph?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.