Hi All,
Using script from:
Here
Works well to send an HTML email.
I am seeking to embed a jpeg image, I seek to do this by converting the image to Base54. If I convert the jpg to Base64 externally and simply add the string it works great but I seek to be able to convert as part of the script.
I have tried:
So it now looks like this:
But this stops the script form running.
Any ideas?
Thank you.
Using script from:
Here
Works well to send an HTML email.
I am seeking to embed a jpeg image, I seek to do this by converting the image to Base54. If I convert the jpg to Base64 externally and simply add the string it works great but I seek to be able to convert as part of the script.
I have tried:
Code:
Dim rawData As Byte() = File.ReadAllBytes("Path_to_file.jpg") Dim base64String As String = Convert.ToBase64String(rawData)
Code:
Imports System.Text Sub Main(Optional ByVal Parms As String = "") Dim sb As New StringBuilder Dim rawData As Byte() = File.ReadAllBytes("Path_to_file.jpg") Dim base64String As String = Convert.ToBase64String(rawData) base64String = thebase64string sb.Append("<font size=5>This is a test from HS3</font>") sb.Append("<br>") sb.Append("<img src='data:image/jpeg;base64," & base64String & "'>") Try hs.SendEmail("", "", "", "", "Test Subject", sb.ToString, "") Catch ex As Exception hs.WriteLog("Info", "Error in send email " & ex.tostring) End Try sb = Nothing End Sub
Any ideas?
Thank you.