Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > inline images for emails

Reply
Thread Tools

inline images for emails

 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-23-2005
Anyone have any reference for adding a image inline into a email body, using
the System.Web.MailMessage? If not MailMessage, then anything else would be
nice.

ie using the cid and embedding the image with the email

Thanks,

bill


 
Reply With Quote
 
 
 
 
Andrew Robinson
Guest
Posts: n/a
 
      05-23-2005
not sure that it can be done. I have always use COM interop with CDO.
Create a "source" web page with your image and point to it. You are creating
an embeded HTML email.

-Andrew


CDO.Message message = new CDO.Message();
CDO.Configuration configuration = new CDO.Configuration();
ADODB.Fields fields = configuration.Fields;

fields[CDO.CdoConfiguration.cdoSendUsingMethod].Value =
CDO.CdoSendUsing.cdoSendUsingPort;
fields[CDO.CdoConfiguration.cdoSMTPServer].Value = "127.0.0.1";
fields[CDO.CdoConfiguration.cdoSMTPServerPort].Value = 25;
fields[CDO.CdoConfiguration.cdoSMTPConnectionTimeout].Value = 30;
fields.Update();

message.Configuration = configuration;

message.To = textBoxTo.Text;
message.From = textBoxFrom.Text;
message.Subject = textBoxSubject.Text;
message.TextBody = "This is your message body.";

try
{
message.CreateMHTMLBody(textBoxUrl.Text, CDO.CdoMHTMLFlags.cdoSuppressNone,
textBoxUsername.Text, textBoxPassword.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
System.Diagnostics.Debug.WriteLine(ex.Message);
}

message.Send();


"William F. Robertson, Jr." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Anyone have any reference for adding a image inline into a email body,

using
> the System.Web.MailMessage? If not MailMessage, then anything else would

be
> nice.
>
> ie using the cid and embedding the image with the email
>
> Thanks,
>
> bill
>
>



 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      05-23-2005
HTML email is just like any other HTML page... meaning to show images, you
need to use a <img> tag with a src attribute that refers to an image that
can be accessed by the user.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Anyone have any reference for adding a image inline into a email body,
> using the System.Web.MailMessage? If not MailMessage, then anything
> else would be nice.
>
> ie using the cid and embedding the image with the email
>
> Thanks,
>
> bill
>




 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-23-2005
"Html email is just like any other Html page".

Unless it is being opened in Outlook 2003, and the company build doesn't
download images automatically. I must place the Base64 encoding of the
image into the email and reference using the src="cid:image_name" for it to
work.

Say hello to Kent for me. I enjoyed chatting with him.

bill


"Brock Allen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> HTML email is just like any other HTML page... meaning to show images, you
> need to use a <img> tag with a src attribute that refers to an image that
> can be accessed by the user.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
> > Anyone have any reference for adding a image inline into a email body,
> > using the System.Web.MailMessage? If not MailMessage, then anything
> > else would be nice.
> >
> > ie using the cid and embedding the image with the email
> >
> > Thanks,
> >
> > bill
> >

>
>
>



 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-23-2005
I guess I could always read the RFC 821 and figure it out. They are
tightening down the way Outlook processes html messages at work, and need a
way around forcing the user to click download to view the header image.

bill

"Andrew Robinson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> not sure that it can be done. I have always use COM interop with CDO.
> Create a "source" web page with your image and point to it. You are

creating
> an embeded HTML email.
>
> -Andrew
>
>
> CDO.Message message = new CDO.Message();
> CDO.Configuration configuration = new CDO.Configuration();
> ADODB.Fields fields = configuration.Fields;
>
> fields[CDO.CdoConfiguration.cdoSendUsingMethod].Value =
> CDO.CdoSendUsing.cdoSendUsingPort;
> fields[CDO.CdoConfiguration.cdoSMTPServer].Value = "127.0.0.1";
> fields[CDO.CdoConfiguration.cdoSMTPServerPort].Value = 25;
> fields[CDO.CdoConfiguration.cdoSMTPConnectionTimeout].Value = 30;
> fields.Update();
>
> message.Configuration = configuration;
>
> message.To = textBoxTo.Text;
> message.From = textBoxFrom.Text;
> message.Subject = textBoxSubject.Text;
> message.TextBody = "This is your message body.";
>
> try
> {
> message.CreateMHTMLBody(textBoxUrl.Text,

CDO.CdoMHTMLFlags.cdoSuppressNone,
> textBoxUsername.Text, textBoxPassword.Text);
> }
> catch (Exception ex)
> {
> MessageBox.Show(ex.Message);
> System.Diagnostics.Debug.WriteLine(ex.Message);
> }
>
> message.Send();
>
>
> "William F. Robertson, Jr." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Anyone have any reference for adding a image inline into a email body,

> using
> > the System.Web.MailMessage? If not MailMessage, then anything else

would
> be
> > nice.
> >
> > ie using the cid and embedding the image with the email
> >
> > Thanks,
> >
> > bill
> >
> >

>
>



 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      05-23-2005
> Unless it is being opened in Outlook 2003, and the company build
> doesn't download images automatically.


Sure, but that's an aspect of the reader, not code that emits and sends the
HTML email.

> I must place the Base64
> encoding of the image into the email and reference using the
> src="cid:image_name" for it to work.


That's interesting; I wasn't aware you could do that. So you send a multi-mime
formatted email with images embedded into it? Well, Outlook refusing to get
images form the web but automatically loading these embedded images doesn't
protect me from buffer overflows in their image processing code. I'm still
vulnerable to attacks then. Shame on outlook

-Brock
DevelopMentor
http://staff.develop.com/ballen



 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-24-2005
You hope that outlook controls its own buffers. Maybe some of that often
hyped "code review" at MS took care of this. Not automatically downloading
images saves spam/email verification and tracking.

<img src=http://spammer.com/images/header.gif?(E-Mail Removed) />

Now the spammer has a confirmed email address.

bill

"Brock Allen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> > Unless it is being opened in Outlook 2003, and the company build
> > doesn't download images automatically.

>
> Sure, but that's an aspect of the reader, not code that emits and sends

the
> HTML email.
>
> > I must place the Base64
> > encoding of the image into the email and reference using the
> > src="cid:image_name" for it to work.

>
> That's interesting; I wasn't aware you could do that. So you send a

multi-mime
> formatted email with images embedded into it? Well, Outlook refusing to

get
> images form the web but automatically loading these embedded images

doesn't
> protect me from buffer overflows in their image processing code. I'm still
> vulnerable to attacks then. Shame on outlook
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>



 
Reply With Quote
 
Kevin
Guest
Posts: n/a
 
      05-25-2005
try: www.aspsimply.com/vbnet/NetMailer.aspx
which does the job and more ...



"William F. Robertson, Jr." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Anyone have any reference for adding a image inline into a email body,
> using
> the System.Web.MailMessage? If not MailMessage, then anything else would
> be
> nice.
>
> ie using the cid and embedding the image with the email
>
> Thanks,
>
> bill
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tool which expands implicitly inline inline functions tthunder@gmx.de C++ 3 06-16-2005 12:54 AM
To inline or not to inline? Alvin C++ 7 05-06-2005 03:04 PM
Function delcared inline but not defined inline Nish C Programming 4 10-08-2004 03:31 PM
External inline functions calling internal inline functions Daniel Vallstrom C Programming 2 11-21-2003 01:57 PM
inline or not to inline in C++ Abhi C++ 2 07-03-2003 12:07 AM



Advertisments