0

i've been working whole day in a little process that automatically sends some data from some excels through mail, the thing is, that those emails must have 2 banners in the beggining and in the end of the mail, here you have a rough example of a single instance not being automatized:

 Dim msg As New MailMessage
    Try
        msg.From = New MailAddress("MYMAIL")
        msg.To.Add("TARGETEMAIL@HOTMAIL.com")
        msg.Subject = "SUBJECT"
        msg.Body = " BODY TEXT "
        Dim path As String = "IMAGEPATH"
        Dim altView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:myImage width=200><br> TEXT.", Nothing, "text/html")
        Dim imagelink As LinkedResource = New LinkedResource(path, MediaTypeNames.Image.Jpeg)
        imagelink.TransferEncoding = TransferEncoding.Base64
        imagelink.ContentId = ("myImage")
        altView.LinkedResources.Add(imagelink)
        msg.AlternateViews.Add(altView)
        msg.IsBodyHtml = True
        Dim SMTP As New SmtpClient("smtp.gmail.com")
        SMTP.Port = 587
        SMTP.EnableSsl = True
        SMTP.Credentials = New System.Net.NetworkCredential("MAIL", "PASSWORD")
        SMTP.EnableSsl = True
        SMTP.Send(msg)
        MsgBox("Message Was Sent correctly.")
    Catch ex As System.Exception
    End Try

This does work.

The problem is that while it works for Yahoo and Gmail, one of the people recieving the messages is using a Hotmail account, and, instead of getting the emails fine (with the two images embedded), like everyone else, he gets blank spaces in the place of the images, also, the mails appear as "attached with some file" but they dont even have the image attached.

i've been trying using the Outlook.Interops Library, and got it to work thanks to some posts and apparently thanks to this:

     Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001F"
     olkPA.SetProperty(PR_ATTACH_CONTENT_ID, "myImage")

but Outlook library does only let me send the email through my outlook account and i need to send the emails through another kind of account. Is there any way to send the emails with the image embedded to a hotmail/outlook account with the way i show you in the first example?

Thank you.

Kukisambas
  • 13
  • 1
  • 5
  • Please post the complete MIME source of the message you are sending. – Dmitry Streblechenko Oct 20 '15 at 20:59
  • Hello Dmitry, what do you mean by MIME Source?, all that was shown in the first block is practically ALL the content of the message, aside from some autogenerated text, which aint the problem, since deleting it still makes the images appear only on Yahoo and Gmail. Thank you. – Kukisambas Oct 21 '15 at 07:17
  • Please see http://stackoverflow.com/questions/1264672/how-to-save-mailmessage-object-to-disk-as-eml-or-msg-file – Dmitry Streblechenko Oct 21 '15 at 17:10

0 Answers0