Image content as email in 2.0

Posted on 2007-07-26
Last Modified: 2013-11-26
for our new site we want to  send the image content as mail(invitation)
But its giving me some error
Error means ,in rediffmail ,yahoo the image is coming as a content
In hotmail it is coming as an attachment..but after some times its opening
But in our domain mail server coming as an attachment
that also coming as  a bin attacthment///
while clicking that bin attachment its opening a html page and its showing the image
the image is .jpg image
is any thing error in the following code...
Please advise me for the same

 Dim mail As New MailMessage

        mail.From = New MailAddress("")

        mail.Subject = "Mail Fromtest"
        Dim plainView As AlternateView
        plainView = AlternateView.CreateAlternateViewFromString("Our Invitation", Nothing, "text/plain")
        Dim htmlView As AlternateView
        htmlView = AlternateView.CreateAlternateViewFromString("Here is an embedded image.<img src=cid:logo>", Nothing, "text/html")
        Dim logo As LinkedResource
        Dim path As String
        path = Server.MapPath("images/newmailcomicnew.jpg")
        logo = New LinkedResource(path)
        logo.ContentId = "logo"

        Dim smtp As New SmtpClient

        smtp = New SmtpClient("") ' //specify the mail server address

Question by:venkatca
    LVL 9

    Expert Comment

    Different clients are going to handle the attachment differently.  If you want the image in the body, perhaps the attachment isn't the way to go.  Here is a scenario that's bandwidth friendly and I think would work well:

    If you are mailing to a mailing list, let the users choose whether they can receive HTML or Text Only email.  

    If Text Only is selected, send the image as an attachment.

    If HTML is selected, do not attach the image, but rather link to the image from within the email and send an html email such as:

    <img src="" />

    This will ensure that the image gets displayed in the body of the message.
    LVL 1

    Author Comment

     It started working fine when I declared the mediatypename
     Dim logo As LinkedResource
            Dim path As String
            path = Server.MapPath("images/newmailcomicnew.jpg")
            logo = New LinkedResource(path)
    LVL 1

    Accepted Solution

    PAQed with points refunded (500)

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now