Embedded graphics in email messages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wulongtea
    New Member
    • Jun 2006
    • 1

    Embedded graphics in email messages

    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(strin g 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 ((_emailTypePre ference == HTML_format_emb edded) || (_emailTypePref erence == HTML_format_att ached))
    {
    gifImage = new MailAttachment( "D:\\temp\\eBil l_email_hdr.gif ");
    Message.BodyFor mat = MailFormat.Html ;
    Message.Attachm ents.Add(gifIma ge);

    } // end if


    //
    // Send the msg
    //
    try
    {
    SmtpMail.Send(M essage);
    } // end try
    catch (Exception ex)
    {
    _objUtil.Append ToLogFile("*** Error: SendEmail: " + " Exception Message: " + ex.Message);
    } // end catch
    // SMTP.Send(msg);
    return true;
    } // end SendEmail

    =============== ==============
Working...