I am trying generate an HTML email message with C# Visual Studio 2003 that has a graphics file embedded in the message. (I know i should be using 2005 and the new classes there, but I cannot upgrade yet due to the policy at my company)
my function seems pretty simple. but what i get is an HTML email that has an attached file, whic his the graphics file. But I would like to have the graphics image embedded inside the email, so it displays with the email.
what am i missing here? do i need to reference the attached gif file from my html email source? it is current reference just by file name. how do i reference the attachment in my html source?
thanks for any help
wulongtea
==============================
public bool SendEmail(string strFrom, string strTo, string strSubject, string strBody)
{
MailMessage Message = new MailMessage();
MailAttachment gifImage;
Message.To = strTo;
Message.From = strFrom;
Message.Subject = strSubject;
Message.Body = strBody;
//
// if we're sending out an html email, then attached the gif image to the email
//
if ((_emailTypePreference == HTML_format_embedded) || (_emailTypePreference == HTML_format_attached))
{
gifImage = new MailAttachment("D:\\temp\\eBill_email_hdr.gif");
Message.BodyFormat = MailFormat.Html;
Message.Attachments.Add(gifImage);
} // end if
//
// Send the msg
//
try
{
SmtpMail.Send(Message);
} // end try
catch (Exception ex)
{
_objUtil.AppendToLogFile("*** Error: SendEmail: " + " Exception Message: " + ex.Message);
} // end catch
// SMTP.Send(msg);
return true;
} // end SendEmail
=============================