By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,775 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,775 IT Pros & Developers. It's quick & easy.

Images in HTML

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.