B4J Question [SOLVED] Sending emails to outlook with web based images [SOLVED]

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All

I have been trying to send a html email to Outlook with no luck. the text arrives but nothing else.

I see that the html on SMTP changes the text that I input.

I went to a spam email that someone sent to me which worked and displayed the images from a url. I copied the html code from the outlook message and saved that to an html file.

I then checked the source by opening it in a browser and it works perfectly, and in outlook.

So I imported this html file into my program and assigned it to smtp.body and also I have smtp.HtmlBody = True

But when it arrives it does not display correctly and looking at the source of the message , there are some letters missing

<meta name=enerator" content=ubSpot"><meta property=g:url" content=ttp://thequestionco-4462250.hs-sites.com/-temporary-slug-
<meta name=-apple-disable-message-reformatting">
<meta http-equiv=ontent-Type" content=ext/html; charset=F-8">
<meta http-equiv=-UA-Compatible" content=Eíge">
<meta name=iewport" content=idthÞvice-width, initial-scale=0">
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:pixelsPerInch>96</o:pixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
And looking at the data after importing it , looks perfect.
Qt: Untested Windows version 10.0 detected!
Qt: Untested Windows version 10.0 detected!
Qt: Untested Windows version 10.0 detected!
Qt: Untested Windows version 10.0 detected!
Qt: Untested Windows version 10.0 detected!
Qt: Untested Windows version 10.0 detected!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice" xmlns:v="urn:schemas-microsoft-com:vml" lang="en"><head>
<title>❓Brand New 2021 Trivia Database❓</title>
<meta property="og:title" content="❓Brand New 2021 Trivia Database❓">
<meta name="twitter:title" content="❓Brand New 2021 Trivia Database❓">



<meta name="x-apple-disable-message-reformatting">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:pixelsPerInch>96</o:pixelsPerInch>
</o:OfficeDocumentSettings>
</xml>

<style>
ul > li {
text-indent: -1em;
}
</style>
<![endif]-->
<!--[if mso]>
<style type="text/css">
body, td {font-family: Arial, Helvetica, sans-serif;}
</style>
<![endif]-->



<meta name="generator" content="HubSpot"><meta property="og:url" content="http://thequestionco-4462250.hs-sites.com/-temporary-slug-d08f7069-7440-430f-99f7-05403c4344b5"><meta name="robots" content="noindex,follow"><!--[if !((mso)|(IE))]><!-- --><style type="text/css">.moz-text-html .hse-column-container{max-width:600px !important;width:600px !important}
.moz-text-html .hse-column{display:table-cell;vertical-align:top}.moz-text-html .hse-section .hse-size-5{max-width:250px !important;width:250px !important}


Having these letters missing is the reason why it is not working.

Has any one also experienced this ?

The initial source of the html is attached

Thank you
 

Attachments

  • peterrec.zip
    8.7 KB · Views: 253
Last edited:

Peter Lewis

Active Member
Licensed User
Longtime User
It has something to do with the quotable content encoding. Use base64 instead:

B4X:
Dim su As StringUtils
    smtp.Body = su.EncodeBase64(h.GetBytes("utf8")) 'h = your html string
    smtp.AdditionalHeaders.Put("Content-Transfer-Encoding", "BASE64")
WOW , I just knew you would have the right answer ... MASTER

Thank you
 
Upvote 0
Top