Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6595673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:58:13+00:00 2026-05-25T17:58:13+00:00

Please can someone give me some pointers on how to send an email with

  • 0

Please can someone give me some pointers on how to send an email with MULTIPLE embedded images.

I can send a basic email and I can also send an email with an single embedded image using AlternateView,

In bodyText as XElement I have : <img src='cid:SCREENSHOT'/>

Then I add the alternative view like this:

Dim htmlContent As AlternateView =    AlternateView.CreateAlternateViewFromString(bodyText.ToString(), Nothing, mediaType)

    If (IO.File.Exists(screenshotPath)) Then

        Dim screenshot As New LinkedResource(screenshotPath)

        screenshot.ContentId = "SCREENSHOT"
        htmlContent.LinkedResources.Add(screenshot)

    End If

    msg.AlternateViews.Add(htmlContent)`

I just cant work out how to get multiple images in there.

Many Thanks

Richard.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:58:13+00:00Added an answer on May 25, 2026 at 5:58 pm

    It involves 2 loops.

    1 loop at the point of creatng the body.

    Call this from BodyText using: <%= CreateImages(imagePaths, hasCustImage) %>

    Private Shared Function CreateImages(ByVal imagePaths As IList(Of String), ByVal hasCustImage As Boolean) As XElement
    
        Dim images As XElement = <span></span>
        Dim temp As XElement = Nothing
    
        For i As Integer = 0 To imagePaths.Count - 1
    
            Dim img As String = String.Format("cid:ItemImage{0}", i + 1)
    
            If ((i = (imagePaths.Count - 1)) And (hasCustImage)) Then
    
                temp = _
                    <p style="font-family: Arial; font-size: 10pt">
                        Customer:<br/>
                        <img src=<%= img %>/>
                    </p>
    
            Else
    
                temp = _
                    <p style="font-family: Arial; font-size: 10pt">
                        <img src=<%= img %>/>
                    </p>
    
            End If
    
            images.Add(temp)
    
        Next
    
        Return images
    
    End Function
    

    Another loop to create the Alternative views:

    msg.Body = bodyText.ToString()
    
        Dim htmlContent As AlternateView = AlternateView.CreateAlternateViewFromString(bodyText.ToString(), Nothing, mediaType)
    
        For i As Integer = 0 To imagePaths.Count - 1
    
            If (IO.File.Exists(imagePaths(i))) Then
    
                Dim itemImage As New LinkedResource(imagePaths(i))
    
                itemImage.ContentId = String.Format("ItemImage{0}", i + 1)
                htmlContent.LinkedResources.Add(itemImage)
    
            End If
    
        Next
    
        msg.AlternateViews.Add(htmlContent)
    
        Return Utils.Send(msg)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can someone please give me some examples where enumeration is used? i dont understand
Can someone please give some fair idea about how to use JSON?
can someone please give me some guidelines on this. I'm fairly new to VBA.
can someone please give me an example on the internet of how the system
Can someone give me a simple example involving threads in this manner, please. Problem
What is the difference? Are these the same? If not, can someone please give
I am not clear with SQL reporting services. Can someone please give me a
Can someone please give me an example of how public and private headers work?
Please can someone help? I have the following code which uploads a file to
In WPF: Can someone please explain the relationship between DependencyProperty and Databinding? I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.