473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1939
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Bill | last post by:
I am trying to have the capability to email attachments. Specifically I want to be able to email a specific attachment that I name that may be a PDF document, text doc, etc. I already have a...
1
by: Bob-O | last post by:
Need your help in sending an email message with an attachment in my VB.Net program. Sending a body message is no problem. I don't know how to use the attachment property in an emai Following is...
5
by: Colin Anderson | last post by:
I discovered, with great excitement, this article http://www.davison.uk.net/vb2notes.asp when researching methods for emailing from Access via Notes. Unfortunatly, when I run this I get a...
4
by: Farooq Khan | last post by:
hi, i'm using CDONTS component for emailing through one of my web service like this // Start of code // 'email' is the CDONTS object name email.send(EmailFrom.ToString(), EmailTo.ToString(),...
4
by: MW de Jager | last post by:
I am sending an email with attachments from a dotnet ASP application. If I send an email it works fine if the attachment is located in a folder on my pc, which is open to all users on that PC, it...
1
by: Will | last post by:
Hey guys, i need a code that will allow users to email to multiple people as well as add as many attachments as user likes, and will work with outlook express/ or microsoft outlook (any version)...
1
by: mike11d11 | last post by:
I'm having a problem trying to add attachments to my email from my C:\ drive. What I'm trying to do here is have my database run a bunch of queries that gives me a report that I'm putting in the...
3
by: dee | last post by:
I need to send an email containing 2 reports. I have tried sending a 2 page snapshot report, but while it prints just fine before sending, email is only receiving 1 page. Is there a way to do...
1
by: =?Utf-8?B?U2FpIFZhamph?= | last post by:
Hi I am trying to send a .pdf document as an email attachment using net.mail. This email is being sent by a windows service application. After i receive the email, and when i try to open the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.