473,320 Members | 1,846 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,320 software developers and data experts.

Images in HTML

We have few Mail templates (.html) which we

use to send mails.

We want to have some Logo in that ie ... when I send the mail to user the

image should go as in-line embedded

image in mail. I am not able to get this. I tried with

Message.Attachments.add ... but its sending the image

as an attachment. Please note I do not want to give any website URL to those

images coz we would be sending mails

to some users who do not have Internet Access. They should be able to see

the Images Offline.

I searched over the net ... and got to know that I have to use PAID third

party tools. I can not believe this.

coz in my 9 yrs experience I have never come across a situation where I

could not achieve something with Microsoft.

Do I have to use Cid (ContentId) ? If YES .. kindly let me know how do I

generate this Cid ?

Kindly let me know how to send HTML mails with in-line embedded images using

C# and ASP.Net
Nov 22 '05 #1
3 2389
Hi,

This should just be a matter of setting your src attributes to the image
name and attaching each image to the mail.

This works for me:

// Put user code to initialize the page here\
MailMessage mail = new MailMessage();
mail.To="te**@test.net";
SmtpMail.SmtpServer="localhost";
mail.From="te**@test.net";
mail.Attachments.Add(new MailAttachment("c:\\temp\\progressbar.gif"));
mail.BodyFormat=System.Web.Mail.MailFormat.Html;
mail.Body="<html><body>test<img src='progressbar.gif'/></body></html>";
SmtpMail.Send(mail);
Hope this helps....
T.Michelle wrote:
We have few Mail templates (.html) which we

use to send mails.

We want to have some Logo in that ie ... when I send the mail to user the

image should go as in-line embedded

image in mail. I am not able to get this. I tried with

Message.Attachments.add ... but its sending the image

as an attachment. Please note I do not want to give any website URL to those

images coz we would be sending mails

to some users who do not have Internet Access. They should be able to see

the Images Offline.

I searched over the net ... and got to know that I have to use PAID third

party tools. I can not believe this.

coz in my 9 yrs experience I have never come across a situation where I

could not achieve something with Microsoft.

Do I have to use Cid (ContentId) ? If YES .. kindly let me know how do I

generate this Cid ?

Kindly let me know how to send HTML mails with in-line embedded images using

C# and ASP.Net

Nov 22 '05 #2
No it won't help, to do that you have to send the e-mail as MIME formatted,
mutlipart/related content type. MailMessage doesn't support this, you need
to write your own class (or find one) that does.

Jerry

"Ruprict" <ru*****@bellsouth.net> wrote in message
news:Hl*******************@bignews1.bellsouth.net. ..
Hi,

This should just be a matter of setting your src attributes to the image
name and attaching each image to the mail.

This works for me:

// Put user code to initialize the page here\
MailMessage mail = new MailMessage();
mail.To="te**@test.net";
SmtpMail.SmtpServer="localhost";
mail.From="te**@test.net";
mail.Attachments.Add(new MailAttachment("c:\\temp\\progressbar.gif"));
mail.BodyFormat=System.Web.Mail.MailFormat.Html;
mail.Body="<html><body>test<img src='progressbar.gif'/></body></html>";
SmtpMail.Send(mail);
Hope this helps....
T.Michelle wrote:
We have few Mail templates (.html) which we

use to send mails.

We want to have some Logo in that ie ... when I send the mail to user the
image should go as in-line embedded

image in mail. I am not able to get this. I tried with

Message.Attachments.add ... but its sending the image

as an attachment. Please note I do not want to give any website URL to those
images coz we would be sending mails

to some users who do not have Internet Access. They should be able to see
the Images Offline.

I searched over the net ... and got to know that I have to use PAID third
party tools. I can not believe this.

coz in my 9 yrs experience I have never come across a situation where I

could not achieve something with Microsoft.

Do I have to use Cid (ContentId) ? If YES .. kindly let me know how do I

generate this Cid ?

Kindly let me know how to send HTML mails with in-line embedded images using
C# and ASP.Net

Nov 22 '05 #3
But I did it and it WORKED. Image was inline just as I specified. I
even tried various HTML tags on the page to move the image around (put
it in a <ul> for example) and it worked. In T. Michelle's case, he
would probably have to build the template in code, but it should still
work out of the box.

Excuse my ignorance, but I am just wondering what I am missing if my
images are showing up inline....

Did you try the code below? Does it matter that I am running IIS?

Jerry III wrote:
No it won't help, to do that you have to send the e-mail as MIME formatted,
mutlipart/related content type. MailMessage doesn't support this, you need
to write your own class (or find one) that does.

Jerry

"Ruprict" <ru*****@bellsouth.net> wrote in message
news:Hl*******************@bignews1.bellsouth.net. ..
Hi,

This should just be a matter of setting your src attributes to the image
name and attaching each image to the mail.

This works for me:

// Put user code to initialize the page here\
MailMessage mail = new MailMessage();
mail.To="te**@test.net";
SmtpMail.SmtpServer="localhost";
mail.From="te**@test.net";
mail.Attachments.Add(new MailAttachment("c:\\temp\\progressbar.gif"));
mail.BodyFormat=System.Web.Mail.MailFormat.Htm l;
mail.Body="<html><body>test<img src='progressbar.gif'/></body></html>";
SmtpMail.Send(mail);
Hope this helps....
T.Michelle wrote:

We have few Mail templates (.html) which we

use to send mails.

We want to have some Logo in that ie ... when I send the mail to user
the
image should go as in-line embedded

image in mail. I am not able to get this. I tried with

Message.Attachments.add ... but its sending the image

as an attachment. Please note I do not want to give any website URL to
those
images coz we would be sending mails

to some users who do not have Internet Access. They should be able to
see
the Images Offline.

I searched over the net ... and got to know that I have to use PAID
third
party tools. I can not believe this.

coz in my 9 yrs experience I have never come across a situation where I

could not achieve something with Microsoft.

Do I have to use Cid (ContentId) ? If YES .. kindly let me know how do I

generate this Cid ?

Kindly let me know how to send HTML mails with in-line embedded images
using
C# and ASP.Net


Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave | last post by:
Hi, I have an app that uses rollover images, but the images are still pulled from the web server during a mouseover instead of being pulled from memory. The code is as follows: the...
3
by: Tim T | last post by:
Hi, I hope there is someone reading this that has the answer, Please Help! I have the need to send a html email via asp.net. its easy enough to send an html email and add attachments. My...
9
by: Jeff | last post by:
I get the following error when I try to rollover my button: document.images has no properties Line: 22 Am I doing this correctly? Suggestions? This is using Netscape 7.2 on Fedora core 4. ...
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
61
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the...
1
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project...
7
by: Leoa | last post by:
Hi All, I'm having a hard time figuring out the DOM syntax to get one frame that has thumnails of images to display at full size in another frame (onmouseover). I looked at a couple...
2
by: wstsoi | last post by:
hi I have to read images from spreadsheet, is it possible to do with php?
2
by: FairyLucy | last post by:
Hello web experts, a question form a lonely beginner in HTML and CSS crying out for help!!, I am trying to stack 5 images of the same dimensions next to each other horizontally as the top bar of...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.