<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to attach image in body of the mail. in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110730#M49898</link>
    <description>&lt;P data-unlink="true"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Dear Ginukuntla,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;Enter the body of your email in plain text (along with image you want to embed) to &lt;A href="https://wordtohtml.net/" target="_blank" rel="noopener"&gt;https://wordtohtml.net/&lt;/A&gt; , and the website will quickly format it into HTML code according to the correct format. Then include that in the body of your email action.&lt;/P&gt;&lt;P data-unlink="true"&gt;This website will provide you with the HTML code that will function with Outlook and all other mail clients after encoding your image into base 64.&lt;/P&gt;&lt;P data-unlink="true"&gt;Thanks,&lt;/P&gt;&lt;P data-unlink="true"&gt;Shahabeel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2024 14:43:33 GMT</pubDate>
    <dc:creator>ShahabeelSulaiman</dc:creator>
    <dc:date>2024-05-21T14:43:33Z</dc:date>
    <item>
      <title>How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110523#M49838</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;We are trying to insert a image within the body of email using Email-POP3/SMTP VBO&lt;/P&gt;&lt;P&gt;We have tried these logics in body of the send message action:&lt;/P&gt;&lt;P&gt;"&amp;lt;html&amp;gt;&amp;lt;p&amp;gt;&amp;lt;img src="&amp;amp;[Attachment Path]&amp;amp;"&amp;gt; name &amp;lt;/img&amp;gt;&amp;lt;p&amp;gt;&amp;lt;html&amp;gt;" and also "&amp;lt;html&amp;gt;&amp;lt;p&amp;gt;&amp;lt;img id="&amp;amp;"ImageID"&amp;amp;" src="&amp;amp;[Attachment Path]&amp;amp;""&amp;amp;":image/png;base64, Base64Code"&amp;amp;"""&amp;lt;p&amp;gt;&amp;lt;html&amp;gt;"&lt;/P&gt;&lt;P&gt;Enabled body is HTML = True&lt;BR /&gt;But we are receiving message as red cross mark image in the email body.&lt;/P&gt;&lt;P&gt;Please find attachments below for your reference:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ginukuntla_0-1715771927456.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38209i52F5756429CC63BF/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Ginukuntla_0-1715771927456.png" alt="Ginukuntla_0-1715771927456.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please assist me to solve this issue, Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 11:24:02 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110523#M49838</guid>
      <dc:creator>Ginukuntla</dc:creator>
      <dc:date>2024-05-15T11:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110579#M49855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A class="" href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/58311" target="_self"&gt;&lt;SPAN class=""&gt;Ginukuntla&lt;/SPAN&gt;&lt;/A&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you check this site :&amp;nbsp;&lt;A href="https://www.emailarchitect.net/easendmail/kb/vbnet.aspx?cat=8#:~:text=%2D%20ImportHtml%20%2D%20Example%5D-,Introduction,cid%3Ayourcontentid%22%20%2F%3E%20." target="_blank" rel="noopener"&gt;Send Email with Embedded Images in VB.NET (emailarchitect.net)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It uses VB net and html.&lt;/P&gt;&lt;P&gt;Regard&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 08:21:45 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110579#M49855</guid>
      <dc:creator>leogarp</dc:creator>
      <dc:date>2024-05-16T08:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110600#M49863</link>
      <description>&lt;P&gt;Just remember that when using HTML and calling images, they need to be available on the Internet; if they are on the local machine or intranet, you will keep having that issue.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 13:32:29 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110600#M49863</guid>
      <dc:creator>expertcr</dc:creator>
      <dc:date>2024-05-16T13:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110667#M49888</link>
      <description>&lt;P&gt;Thankyou &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/426"&gt;@expertcr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any alternative solution to achieve and to overcome this issue.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 13:22:55 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110667#M49888</guid>
      <dc:creator>Ginukuntla</dc:creator>
      <dc:date>2024-05-20T13:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110694#M49894</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/58311"&gt;@Ginukuntla&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Use this VBO to convert the image itself to base64: Output -&amp;gt;&amp;nbsp;[imageBase64]&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can find it on Digital Exchange.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Erika_Papp_0-1716278933850.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38268iFF2C617576047578/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Erika_Papp_0-1716278933850.png" alt="Erika_Papp_0-1716278933850.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After that just add the following code to the HTML email message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Erika_Papp_1-1716279157514.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38269i6BF6919C49FF0337/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Erika_Papp_1-1716279157514.png" alt="Erika_Papp_1-1716279157514.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 08:12:48 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110694#M49894</guid>
      <dc:creator>Erika_Papp</dc:creator>
      <dc:date>2024-05-21T08:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110730#M49898</link>
      <description>&lt;P data-unlink="true"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Dear Ginukuntla,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;Enter the body of your email in plain text (along with image you want to embed) to &lt;A href="https://wordtohtml.net/" target="_blank" rel="noopener"&gt;https://wordtohtml.net/&lt;/A&gt; , and the website will quickly format it into HTML code according to the correct format. Then include that in the body of your email action.&lt;/P&gt;&lt;P data-unlink="true"&gt;This website will provide you with the HTML code that will function with Outlook and all other mail clients after encoding your image into base 64.&lt;/P&gt;&lt;P data-unlink="true"&gt;Thanks,&lt;/P&gt;&lt;P data-unlink="true"&gt;Shahabeel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 14:43:33 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110730#M49898</guid>
      <dc:creator>ShahabeelSulaiman</dc:creator>
      <dc:date>2024-05-21T14:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110813#M49936</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/911"&gt;@Erika_Papp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using utility-&amp;nbsp;&lt;SPAN&gt;convert the image to base64, and added the code in the body that you have mentioned.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;but still facing the same issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please find the below screenshot for reference:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ginukuntla_0-1716468148878.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38299i320855400A89B838/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Ginukuntla_0-1716468148878.png" alt="Ginukuntla_0-1716468148878.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there any alternate solution for this.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 12:49:22 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110813#M49936</guid>
      <dc:creator>Ginukuntla</dc:creator>
      <dc:date>2024-05-23T12:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110847#M49949</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/58311"&gt;@Ginukuntla&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;You can send the images as part of the email body by following the below steps:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Open the SMTP/POP3 business object and make a copy of the action - '&lt;STRONG&gt;Send Email&lt;/STRONG&gt;' and you can name it as '&lt;STRONG&gt;Send Email With Image&lt;/STRONG&gt;' as shown below:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_0-1716507468318.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38313i922D07819177ECD3/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_0-1716507468318.png" alt="devneetmohanty07_0-1716507468318.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;Now, add a data item called '&lt;STRONG&gt;ImagePath&lt;/STRONG&gt;' of text type and add it as an input argument to your code stage as well:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_1-1716507691430.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38314iBAE7FA6A2B2D0962/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_1-1716507691430.png" alt="devneetmohanty07_1-1716507691430.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Now, in the code tab enter the following code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SmtpClient client = new SmtpClient();
try
{
	client.Host = Server;
	client.Port = (int)Port;
	if (Username != "")
		client.Credentials = new NetworkCredential(Username,Password);
	client.EnableSsl = UseSSL;

	using(MailMessage mail = new MailMessage())
	{
		mail.From = new MailAddress(From);
		mail.To.Add(To);
		mail.Subject = Subject;
		mail.IsBodyHtml = BodyIsHTML;
		
		
		// Embed image in the email body
                if (BodyIsHTML &amp;amp;&amp;amp; !string.IsNullOrEmpty(ImagePath) &amp;amp;&amp;amp; File.Exists(ImagePath))
                {
                    LinkedResource inlineImage = new LinkedResource(ImagePath, MediaTypeNames.Image.Jpeg);
                    inlineImage.ContentId = Guid.NewGuid().ToString();

                    string htmlBody = Body + $"&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;img src='cid:{inlineImage.ContentId}' /&amp;gt;";
                    AlternateView avHtml = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
                    avHtml.LinkedResources.Add(inlineImage);

                    mail.AlternateViews.Add(avHtml);
                }
                else
                {
                    mail.Body = Body;
                }

		foreach(DataRow dr in Attachments.Rows)
		{
			string file = dr["Path"].ToString();
			Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
			ContentDisposition dis = data.ContentDisposition;
			dis.CreationDate = File.GetCreationTime(file);
			dis.ModificationDate = File.GetLastWriteTime(file);
			dis.ReadDate = File.GetLastAccessTime(file);
			mail.Attachments.Add(data);
		}

		client.Send(mail);
	}
}
catch(Exception ex)
{
	string msg = ex.Message;
	if(ex.InnerException != null) {
		msg += " - " + ex.InnerException.Message;
	}
	throw new Exception(msg);
}
finally
{
	IDisposable disposableClient = client as IDisposable;
	if (disposableClient!=null)
		disposableClient.Dispose();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To summarize the change, we are creating an alternate view that will comprise of our image as part of the HTML content of the email body.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Now, you can pass the configuration parameters for your SMTP call and set IsHTMLBody parameter as '&lt;STRONG&gt;True&lt;/STRONG&gt;' and pass the image file path as well:&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_2-1716508453518.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38315i1AF040582596627B/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_2-1716508453518.png" alt="devneetmohanty07_2-1716508453518.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;First, run the '&lt;STRONG&gt;Configure&lt;/STRONG&gt;' page and then run the '&lt;STRONG&gt;Send Email With Image&lt;/STRONG&gt;' page to test it from the object studio itself:&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_3-1716508607893.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38316i246DF6E0D49F421B/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_3-1716508607893.png" alt="devneetmohanty07_3-1716508607893.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_4-1716508796841.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38317i7F062406842D8BCD/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_4-1716508796841.png" alt="devneetmohanty07_4-1716508796841.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Now, when you have tested the action, ensure you add the ImagePath variable as an Input Parameter in the Start stage, reset or clear all the initial values from your data items in both '&lt;STRONG&gt;Configure&lt;/STRONG&gt;' and '&lt;STRONG&gt;Send Email With Image&lt;/STRONG&gt;' page and finally publish the action '&lt;STRONG&gt;Send Email With Image&lt;/STRONG&gt;' prior to saving the business object and testing the same from Process Studio.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 24 May 2024 00:07:18 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110847#M49949</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2024-05-24T00:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110857#M49956</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1843"&gt;@devneetmohanty07&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to send multiple images in body of the mail. If Possible, please assist me.&lt;/P&gt;&lt;P&gt;For Example, if we have three images in our folder, after sending mail I want to see three images in body of that mail.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 13:16:53 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110857#M49956</guid>
      <dc:creator>rokkam_saiteja</dc:creator>
      <dc:date>2024-05-24T13:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110876#M49963</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/48054"&gt;@rokkam_saiteja&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Certainly, if your requirement is to send multiple images as part of the email body itself, I would advise to follow the same approach with I have suggested in the previous replies with certain tweaks:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Open the SMTP/POP3 business object and make a copy of the action - '&lt;/SPAN&gt;&lt;STRONG&gt;Send Email&lt;/STRONG&gt;&lt;SPAN&gt;' and you can name it as '&lt;/SPAN&gt;&lt;STRONG&gt;Send Email With Multiple Images&lt;/STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;' as shown below:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_0-1716583077001.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38322i62B37EBD8141C75E/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_0-1716583077001.png" alt="devneetmohanty07_0-1716583077001.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Now, add a collection called '&lt;/SPAN&gt;&lt;STRONG&gt;ImagePaths&lt;/STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;' with a field value called '&lt;STRONG&gt;ImagePath&lt;/STRONG&gt;' of text type and add it as an input argument to your code stage as well:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_1-1716583264852.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38323i33F311A8FF0DBFBA/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_1-1716583264852.png" alt="devneetmohanty07_1-1716583264852.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&lt;SPAN&gt;&lt;SPAN&gt;Now, in the code tab enter the following code:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;SmtpClient client = new SmtpClient();

try
{
    client.Host = Server;
    client.Port = (int)Port;
    if (!string.IsNullOrEmpty(Username))
        client.Credentials = new NetworkCredential(Username, Password);
    client.EnableSsl = UseSSL;

    using (MailMessage mail = new MailMessage())
    {
        mail.From = new MailAddress(From);
        mail.To.Add(To);
        mail.Subject = Subject;
        mail.IsBodyHtml = BodyIsHTML;

        // Embed image in the email body
        if (BodyIsHTML &amp;amp;&amp;amp; ImagePaths.Rows.Count &amp;gt; 0)
        {
            string htmlBody = Body;
            LinkedResource[] linkedResources = new LinkedResource[ImagePaths.Rows.Count];
            for (int i = 0; i &amp;lt; ImagePaths.Rows.Count; i++)
            {
                string imageFile = ImagePaths.Rows[i]["ImagePath"].ToString();
                linkedResources[i] = new LinkedResource(imageFile, MediaTypeNames.Image.Jpeg)
                {
                    ContentId = Guid.NewGuid().ToString()
                };

                // Append image HTML to the body
                htmlBody += $"&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;img src='cid:{linkedResources[i].ContentId}' style='width:200px; height:auto;'/&amp;gt;";
            }

            AlternateView avHtml = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
            foreach (var linkedResource in linkedResources)
            {
                avHtml.LinkedResources.Add(linkedResource);
            }
            mail.AlternateViews.Add(avHtml);
        }
        else
        {
            mail.Body = Body;
        }

        // Add attachments
        foreach (DataRow dr in Attachments.Rows)
        {
            string file = dr["Path"].ToString();
            Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
            ContentDisposition dis = data.ContentDisposition;
            dis.CreationDate = File.GetCreationTime(file);
            dis.ModificationDate = File.GetLastWriteTime(file);
            dis.ReadDate = File.GetLastAccessTime(file);
            mail.Attachments.Add(data);
        }

        client.Send(mail);
    }
}
catch (Exception ex)
{
    string msg = ex.Message;
    if (ex.InnerException != null)
    {
        msg += " - " + ex.InnerException.Message;
    }
    throw new Exception(msg);
}
finally
{
    IDisposable disposableClient = client as IDisposable;
    if (disposableClient != null)
        disposableClient.Dispose();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Main difference in this code is that, instead of one image path we are iterating over the collection of image paths and setting up an array of &lt;STRONG&gt;LinkedResource&lt;/STRONG&gt; objects based on the number of image paths provided.&lt;BR /&gt;&lt;BR /&gt;Then, each of these objects have a contentId which is getting appended to an HTML string with an adjustable width so that they do not span all across the email body.&lt;BR /&gt;&lt;BR /&gt;Finally, we create an alternate view out of these HTML strings and then the LinkedResource objects are also added to the alternate view as well.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;&lt;SPAN&gt;Now, you can pass the configuration parameters for your SMTP call and set IsHTMLBody parameter as '&lt;/SPAN&gt;&lt;STRONG&gt;True&lt;/STRONG&gt;&lt;SPAN&gt;' and pass the image file paths as part of the collection:&lt;/SPAN&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_2-1716583808396.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38324iA6A77C860E78E8D6/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_2-1716583808396.png" alt="devneetmohanty07_2-1716583808396.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;First, run the '&lt;/SPAN&gt;&lt;STRONG&gt;Configure&lt;/STRONG&gt;&lt;SPAN&gt;' page and then run the '&lt;/SPAN&gt;&lt;STRONG&gt;Send Email With Multiple Images&lt;/STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;' page to test it from the object studio itself:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devneetmohanty07_3-1716584018715.png" style="width: 400px;"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/38325i11C1BB63C736D6B6/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="devneetmohanty07_3-1716584018715.png" alt="devneetmohanty07_3-1716584018715.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Now, when you have tested the action, ensure you add the ImagePaths collection as an Input Parameter in the Start stage, reset or clear all the initial values from your data items in both '&lt;/SPAN&gt;&lt;STRONG&gt;Configure&lt;/STRONG&gt;&lt;SPAN&gt;' and '&lt;/SPAN&gt;&lt;STRONG&gt;Send Email With Multiple Images&lt;/STRONG&gt;&lt;SPAN&gt;' page and finally publish the action '&lt;/SPAN&gt;&lt;STRONG&gt;Send Email With Multiple Images&lt;/STRONG&gt;&lt;SPAN&gt;' prior to saving the business object and testing the same from Process Studio.&lt;BR /&gt;&lt;BR /&gt;From process studio, just ensure you have a collection with all your image paths saved in individual rows with the field name set as '&lt;STRONG&gt;ImagePath&lt;/STRONG&gt;' and you can pass that to your newly created action now.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 24 May 2024 20:58:01 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/110876#M49963</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2024-05-24T20:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to attach image in body of the mail.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/112404#M50371</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1843"&gt;@devneetmohanty07&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Your solution is great for sending an email with images. I have a process where I need to send an instruction email. This email contains both text and an image. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;Dear Sir and Madam,&lt;/P&gt;&lt;P&gt;Please follow the below instruction.&lt;/P&gt;&lt;P&gt;Step: text&lt;/P&gt;&lt;P&gt;Image&lt;/P&gt;&lt;P&gt;Step 2: text&lt;/P&gt;&lt;P&gt;Image 1&lt;/P&gt;&lt;P&gt;Image 2&lt;/P&gt;&lt;P&gt;Step 3: text&lt;/P&gt;&lt;P&gt;Image&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Text&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you provide a solution for this process?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 08:44:11 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-attach-image-in-body-of-the-mail/m-p/112404#M50371</guid>
      <dc:creator>mmostaquim</dc:creator>
      <dc:date>2024-07-16T08:44:11Z</dc:date>
    </item>
  </channel>
</rss>

