I am able to send the image using SMTP mail message activity.
But i have shared the above image, in that image in the body is very small, I need it bigger, user able to see when open the mail.
Body (as html)="
Hi Team,
Please find the process status distribution chart below:
Regards,
Bot
"
Note: Image_path="C:\Users\Admin\Desktop\UiPath Workflows\Email Automation\StatusChart.png
Help me, i need the image in the body is bigger size.
@Vanitha_VS You can control the image size using the width or style attribute in the tag. Also, instead of using only Path.GetFileName(Image_Path), convert the local image to Base64 so it is actually embedded in the mail body.
Then use this in the HTML body:
“Hi Team,” &
“Please find the process status distribution chart below:” &
“<img src='data:image/png;base64,” & base64Image & "’ " &
“style=‘width:700px; max-width:100%; height:auto; display:block;’ />” &
"
" &
“Regards,
Bot”
In Send SMTP Mail Message, make sure:
IsBodyHtml = True
Image_Path contains the complete image path
You can change 700px to 800px, 900px, etc. depending on the required size. height:auto will keep the image proportionate.
Keep your image path in the existing variable: Image_Path = “C:\Users\Admin\Desktop\UiPath Workflows\Email Automation\StatusChart.png”
Remove the current Base64 <img> code:
Add an Invoke Code activity before your current SMTP activity.
Set the Invoke Code language to VB.
Add these arguments to Invoke Code:
Direction
Name
Type
In
Image_Path
String
In
MailTo
String
In
MailFrom
String
In
SMTPServer
String
In
SMTPPort
Int32
In
SMTPUser
String
In
SMTPPassword
String
Put this code inside Invoke Code
Dim mail As New System.Net.Mail.MailMessage()
mail.From = New System.Net.Mail.MailAddress(MailFrom)
mail.To.Add(MailTo)
mail.Subject = “Process Status Distribution”
Dim htmlBody As String =
“” &
“Hi Team,” &
“Please find the process status distribution chart below:” &
“” &
"
" &
“Regards,
Bot” &
“”
Dim htmlView As System.Net.Mail.AlternateView =
System.Net.Mail.AlternateView.CreateAlternateViewFromString(
htmlBody,
Nothing,
System.Net.Mime.MediaTypeNames.Text.Html
)
Dim imageResource As New System.Net.Mail.LinkedResource(
Image_Path,
System.Net.Mime.MediaTypeNames.Image.Png
)
@Vanitha_VS
if changing the width in the HTML still gives the same small image, I’d try embedding it as an inline image using a Content-ID/LinkedResource instead of Base64.
Some mail clients, especially Outlook, don’t handle Base64 images consistently.
Also check the original PNG dimensions. If the generated chart itself is very small, try generating it at a larger resolution first and then set the displayed width around 700–800px.