473,574 Members | 2,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1952
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.Mai l
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
10950
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 working piece of code that emails jpg attachments but does not work with any other types of attachments. Could someone tell me how to modify this code to...
1
341
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 an excerpt from the program Imports System.Web.Mai Imports System.Web.HttpServerUtilit Imports System.Diagnostics Public Class Emailin...
5
7370
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 Run-time error. When I run it on an XP machine it crashes, but on an NT box it just generates an unknown error, handled by the error handler. I have...
4
1441
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(), Subject.ToString(), Body.ToString(), 1)
4
1302
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 usually works fine. If I try to send something form My Documents, the file cannot be sent. Why is this? Kind regards MW de Jager
1
1235
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) ... (can it also go through the anti virus program before being sent ?) THANX IN ADVANCE NEED THE CODE PLEASE
1
1547
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 body of my email message as HTML format using a macro Sendobject. But this doesn't allow me to add any attachments from my machine. I'm positive...
3
2207
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 this in VB code? Can I somehow program the 'Attach:' line in outlook express to include 'Report1' and 'Report2'? If there is, I would very...
1
3262
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 attachment, i get the following error message... "adobe reader could not open <filenamebecuase it is either not a suppported file type or because...
0
7841
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7762
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8105
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8272
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5336
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3774
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1101
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.