Gmail API encoding html and css in addition to base64 - encoding

I'm pulling some mail from the Gmail API. I've got some sample body text here. This is after base-64 decoding. This is the body of a sample email from my inbox.
Mobile Web Developer - new
Moovweb
http://www.glassdoor.com/partner/jobListing.htm?pos=101&ao=77320&s=224&guid=00000152113cfb4fa8f086376239205e&src=GD_JOB_AD&t=JA&extid=13&exst=O&ist=&ast=O&vt=e&ja=23120341&uido=50A7E22F0FAE3A77415539AAADB05038&slr=false&cb=1451988155901&jobListingId=1579397251&utm_medium=email&utm_source=jobalert&utm_campaign=jobAlertAlert&utm_content=ja-viewjob&encryptedUserId=50A7E22F0FAE3A77415539AAADB05038
Web Developer - new
Applied Systems
http://www.glassdoor.com/partner/jobListing.htmÃœÃLL‰˜[ÃMŒŽIÅ“ÃLŒ￾ â„¢ÃZYLMLÅ’LLØÙ˜￾˜NÅ’
Å’ÃÃÅ’Å’ÃŽLÅ’
YIœÜ˜ÃQÑғ×ÃQ ￾R￾Iâ„¢^YLLÉ™^ÃSÉš\ÃIËœ\ÃSÉ￾￾YIÅ¡ËœOLÅ’ÃŒLÅ’ÃI￾ZYÃMLMÑLŒ‘Œ￾QLÃMÃÃMMLÃŽPPPQÅ’
LÎ œÛ￾Y˜[ÙI˜Ø￾LM
LNNMMNLŽIš›Ø“\Ã[™ÒYLMLN
LŽ
As you can see, after base-64 decoding it, part of it is decoded correctly, such as the title nad the url. The garbage bellow is the content that was originally html and css, I believe, so it makes sense that it would have been encoded differently on Google's side. Does anyone know what encoding this is?
I've tried:
`mb_convert_encoding($body_string, "UTF-8", "Windows-1252");`
and
`mb_convert_encoding($body_string, "UTF-8", "ISO-8859-1");`
With no luck.

Related

Send email in Azure Logic App with binary attachment

I am trying to use the "Send an email" on the office365 connector.
I am trying to send an email with a binary attachement. When i receive the email the content appears to be Base64 encoded. In order for my file to work, the content should not the raw binary payload.
How do i avoid the base64 encoding? I tried removing the base64 part: #{base64(body('binaryStuff'))} in the code, but that caused my app to fail, with a "BadRequest" message.
How do i send a binary attachement in my logic app?
After letting the function return Base64 string of the mail attachment instead of byte[], the logic app seems to be able to figure out that the contents is encoded.

Test email rendering - HTML raw source or HTML pre send?

I am testing some HTML email layout, I am not sure to understand which is the HTML I should consider:
use the HTML as it is sent from my server to mailgun (an email service provider)?
use the HTML as I receive it in raw format in the email I receive?
The difference is that in the raw source I receive there are =3D and =20 characters because of the quoted printable format. I'm using testi# but I suppose any rendering software will do, just it's not clear which version of the HTML should be used (needless to say I see =20 everywhere if it's raw, whereas it's perfect if I use the "pure" HTML)
You should use the HTML as it is before being sent. I'm unsure of how testi# works but with other services such as Litmus & Email on Acid you can send a test to them directly from your ESP and they will process that for the previews.
[Added from comment on question to allow close]

How can I force Mailgun to send an e-mail using base64 encoding via API (php)?

I am sending an HTML e-mail via API whichi s UTF-8, however Mailgun seems to sometime use base64/UTF-8 and sometimes use quoted-printable ascii.
I am having a problem with Outlook 2013 (incorrectly I believe) re-writing the header of the HTML e-mail from UTF-8 to ascii and then not displaying my pound sign: £ as it doesn't exist in ascii.
I suspect this is happening in Outlook 2013 becuase the character encoding of the mime part is ascii and the e-mail is UTF-8. I believe the only way to get round this is to force Mailgun to send the e-mail using base64 mime encoding and UTF-8 but I don't know how to force that to happen using the API.
I am quite sure this is not the best solution but in case it helps anyone, I have simply added a pound sign which is styled white. I know it seems horrible, but I haven't found anything better and it seems to work!
<font style="font-size: 2px;" color="#ffffff" size="2">£</font>

Hotmail can not properly read email with ! in url

I have a single page app, which has URLs like http://example.com/#!something/something/. The problem is that when I send email containing link to such url, hotmail users get them wrong (I have noticed it only in hotmail, everyone else is good).
The ! is encoded to %21 which makes the url wrong: http://example.com/#%21something/something/
Any ideas what can be done except rewriting my app :-). I am using swiftmailer to send email, but I highly doubt that this is relevant.
According to RFC3986, the "!" character is valid in the fragment (#...) component of URIs, so it should not get encoded using percent-encoding. In this sense, this seems to be an outlook.com bug.
One workaround is to use plain-text emails: based on my tests, outlook.com encodes !'s HTML email links only and plain-text emails are safe.
The real solution, however, is to do your own normalization in the client-side code. URL cracking and normalization is a really tricky business, so I'd expect issues with other email clients, too. Running JavaScript decodeUriComponent() against window.location.hash should give you the unencoded "#!/something/something" version regardless whether the exclamation mark was encoded or not. I understand this calls for modifying the web application that you wanted to avoid, but to my best knowledge this is the way to go.

Problems sending HTML mail with attachment on iPhone

I'm trying to send a JPG attachment with a formatted HTML message. Of course I'm using [picker setMessageBody:emailBody isHTML:YES];
The rest of the code is what it is supposed to be, according to various messages on forums.
What I observe: the contents of the resulting e-mail message depends on the configured e-mail account on your iPhone.
E.g.: for a Yahoo mail account, setting isHTML to YES never results in an HTML message, but setting it to NO does! Bug in Apple stuff?
But, for a GMail account, I've never succeeded to send an HTML mail, it is always received as plain text.
The JPG file is sometimes shown inline, sometimes as an attachment.
All I want: send a JPG file, and a message containing some line breaks. Does anybody have some proven code that does just that, working for all kinds of e-mail accounts?
Even if you set isHTML param to YES, your message body can be sent as plain/text if the message body can be represented as such. And attachments in plain/text messages are not always recognized correctly by some email clients (Outlook).
In my case adding a link in the message body helped. Formatting text as bold with HTML tags works too. Tricky!
Tested on iPod 1G 3.1.3.