-
Mar 12th, 2017, 06:47 PM
#1
Thread Starter
Hyperactive Member
Multiple images in SMTP
Hello
I have this code to embed two images in a HTML email in my SMTP code:
Code:
Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:dimaHeader><br /><br /><img src=cid:Back2a><br /><br /><br /><body style='font-family......</body>", Nothing, "text/html")
Dim Logo As New LinkedResource(Server.MapPath("~/Images/dimaHeader.jpg"), "image/jpeg") 'embedded image
Logo.ContentId = "dimaHeader"
HtmlMessage.LinkedResources.Add(Logo)
Logo.ContentId = "Back2a"
HtmlMessage.LinkedResources.Add(Logo)
The first image, the banner (dimaHeader.jpg) appears in the email. but not the second image, Back2a.jpg (though I can see the image placeholder). That is because I haven't referenced Back2a.jpg (I think).
How would I do that, please, given that I have already declared 'Logo'.
Thank you.
-
Mar 13th, 2017, 12:13 PM
#2
Re: Multiple images in SMTP
you reuse it...
Code:
Dim Logo As New LinkedResource(Server.MapPath("~/Images/dimaHeader.jpg"), "image/jpeg") 'embedded image
Logo.ContentId = "dimaHeader"
HtmlMessage.LinkedResources.Add(Logo)
Logo = New LinkedResource(Server.MapPath("~/Images/Back2a.jpg"), "image/jpeg") 'embedded image
Logo.ContentId = "Back2a"
HtmlMessage.LinkedResources.Add(Logo)
-tg
-
Mar 13th, 2017, 04:02 PM
#3
Thread Starter
Hyperactive Member
Re: Multiple images in SMTP
That's just what the doctor ordered, tg - thank you again. Problem is that the image pushes the text to the bottom of the inbox window instead of the text appearing on top of the image. My email inbox now looks like this:
-
Mar 13th, 2017, 04:05 PM
#4
Re: Multiple images in SMTP
well, that's another issue... but if I had to guess, it depends on the HTMLBody ... my guess is the attachments are in line, and aren't being used as a background to anything.
-tg
-
Mar 13th, 2017, 05:18 PM
#5
Thread Starter
Hyperactive Member
Re: Multiple images in SMTP
OK, I will do some research on it.
It's not really an attachment though, is it, because it's embedded.
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|