HTML email on Android

Have this working just fine on the ios but trying to test things out on Android and not having much fun with the email. I have simplified my example for purposes of making my point here. If i send an email on IOS with html content like:

local options =  
 {  
 subject = "My High Score",  
 isBodyHtml = true,  
 body = "[html]

# Foobar

- foo
- bar
[/html]",  
  
  
 }  
 native.showPopup("mail", options)  

all is well however doing the same thing on android it appears that all the HTML is stripped out … when the email client comes up it does not show as html format but as plain text with all the tags stripped out. Looking at the received email on the client we get:

[text]
MIME-Version: 1.0
Received: by 10.76.151.169 with HTTP; Wed, 19 Dec 2012 13:05:17 -0800 (PST)
Received: by 10.76.151.169 with HTTP; Wed, 19 Dec 2012 13:05:17 -0800 (PST)
Date: Wed, 19 Dec 2012 16:05:17 -0500
Delivered-To: mslack@rockspiritdesigns.com
Message-ID:
Subject: My High Score
From: Marc Slack
To: Marc Slack
Content-Type: multipart/alternative; boundary=f46d041c6194b0283204d13af82c

–f46d041c6194b0283204d13af82c
Content-Type: text/plain; charset=ISO-8859-1

Foobar

foobar

–f46d041c6194b0283204d13af82c
Content-Type: text/html; charset=ISO-8859-1

Foobar



foobar




–f46d041c6194b0283204d13af82c–
[/text]

you can see that my html tags are lost. Any ideas what i might be doing wrong? I tried to search for a similar post but my search skills are lacking or there is no such post.

Anyway I appreciate any guidance that might be given.

marc [import]uid: 118012 topic_id: 34154 reply_id: 334154[/import]

Poke … this one is killing me. I know that the android gmail client can view html but somehow my HTML is being removed / simplified somewhere between my call to native.showPopup(“mail”, options) and the email client getting ahold of the email.

Kinda like the headers are not setup right or something.
Anyone get html email working on the Android?

Thanks!! [import]uid: 118012 topic_id: 34154 reply_id: 139978[/import]

Marc,

I just tested this now and it worked.

I tested HTML e-mail via our “Networking/ComposeEmailSMS” sample app that is included with the Corona SDK on my Samsung Galaxy Nexus running Android 4.0.4 via its Gmail app. I looked at the raw e-mail and Gmail sent both a “text/plain” and a “text/html” just like yours, except the HTML was sent unaltered.

So, what mail app are you using on your Android device?
Is it a 3rd party mail app?
If so, then the mail app might be the one that is altering your HTML… because Corona just sends your HTML text as-is to the mail app via an Android intent.

Also, what is the make and model of your Android device?
And what Android OS version is it running?
[import]uid: 32256 topic_id: 34154 reply_id: 140150[/import]

Thanks for taking a look at this … very frustrating …

I am using the gmail app that came delivered with my AT&T Galaxy Note II.

Running Android 4.1.1

I’ve tried everything i can think of and get the same result. Given the simplicity of the example i posted i am sure it is nothing in my code that is creating the issue.

Any other insights you might have would be most welcome!

m [import]uid: 118012 topic_id: 34154 reply_id: 140154[/import]

I just tried sending an e-mail exactly how you are sending it, as so…
[lua]local options =
{
subject = “My High Score”,
isBodyHtml = true,
body = "[html]

Foobar

  • foo
  • bar
    [/html]",
    }
    native.showPopup(“mail”, options)[/lua]

When I received the e-mail, it was displayed correctly, but I noticed that the HTML was altered as follows…
[lua]Content-Type: text/html; charset=ISO-8859-1

Foobar

foobar

[/lua]

I’m thinking that the Gmail app doesn’t like certain HTML tags and is changing them. Corona has no control over what the mail app does. So, I’m thinking that you’ll need to change the content of your message to something that Gmail prefers. Not sure what else we can do about it.
[import]uid: 32256 topic_id: 34154 reply_id: 140163[/import]

Poke … this one is killing me. I know that the android gmail client can view html but somehow my HTML is being removed / simplified somewhere between my call to native.showPopup(“mail”, options) and the email client getting ahold of the email.

Kinda like the headers are not setup right or something.
Anyone get html email working on the Android?

Thanks!! [import]uid: 118012 topic_id: 34154 reply_id: 139978[/import]

Marc,

I just tested this now and it worked.

I tested HTML e-mail via our “Networking/ComposeEmailSMS” sample app that is included with the Corona SDK on my Samsung Galaxy Nexus running Android 4.0.4 via its Gmail app. I looked at the raw e-mail and Gmail sent both a “text/plain” and a “text/html” just like yours, except the HTML was sent unaltered.

So, what mail app are you using on your Android device?
Is it a 3rd party mail app?
If so, then the mail app might be the one that is altering your HTML… because Corona just sends your HTML text as-is to the mail app via an Android intent.

Also, what is the make and model of your Android device?
And what Android OS version is it running?
[import]uid: 32256 topic_id: 34154 reply_id: 140150[/import]

Thanks for taking a look at this … very frustrating …

I am using the gmail app that came delivered with my AT&T Galaxy Note II.

Running Android 4.1.1

I’ve tried everything i can think of and get the same result. Given the simplicity of the example i posted i am sure it is nothing in my code that is creating the issue.

Any other insights you might have would be most welcome!

m [import]uid: 118012 topic_id: 34154 reply_id: 140154[/import]

I just tried sending an e-mail exactly how you are sending it, as so…
[lua]local options =
{
subject = “My High Score”,
isBodyHtml = true,
body = "[html]

Foobar

  • foo
  • bar
    [/html]",
    }
    native.showPopup(“mail”, options)[/lua]

When I received the e-mail, it was displayed correctly, but I noticed that the HTML was altered as follows…
[lua]Content-Type: text/html; charset=ISO-8859-1

Foobar

foobar

[/lua]

I’m thinking that the Gmail app doesn’t like certain HTML tags and is changing them. Corona has no control over what the mail app does. So, I’m thinking that you’ll need to change the content of your message to something that Gmail prefers. Not sure what else we can do about it.
[import]uid: 32256 topic_id: 34154 reply_id: 140163[/import]

I tried the same code from mslack, it shows correct in the Android gmail compose mode, but it shows no html effect in inbox, just plain text.

[blockcode]

Content-Type: multipart/alternative; boundary=e0cb4e6fff9364170004d57ea773

–e0cb4e6fff9364170004d57ea773
Content-Type: text/plain; charset=ISO-8859-1

Foobar

foobar

–e0cb4e6fff9364170004d57ea773
Content-Type: text/html; charset=ISO-8859-1

Foobar

foobar

–e0cb4e6fff9364170004d57ea773–

[/blockcode]
Using Android 4.2.1, and Gmail app, v4.2.1 [import]uid: 143031 topic_id: 34154 reply_id: 142451[/import]

This isn’t a Corona issue. The gmail app is altering your HTML text. We have no control over that. I find that the best thing to do is to change your HTML to use tags that the gmail app won’t alter. For example, the HTML e-mailed by our sample app “Networking/ComposeEmailSMS” does not get altered by gmail. [import]uid: 32256 topic_id: 34154 reply_id: 142668[/import]

I tried the same code from mslack, it shows correct in the Android gmail compose mode, but it shows no html effect in inbox, just plain text.

[blockcode]

Content-Type: multipart/alternative; boundary=e0cb4e6fff9364170004d57ea773

–e0cb4e6fff9364170004d57ea773
Content-Type: text/plain; charset=ISO-8859-1

Foobar

foobar

–e0cb4e6fff9364170004d57ea773
Content-Type: text/html; charset=ISO-8859-1

Foobar

foobar

–e0cb4e6fff9364170004d57ea773–

[/blockcode]
Using Android 4.2.1, and Gmail app, v4.2.1 [import]uid: 143031 topic_id: 34154 reply_id: 142451[/import]

This isn’t a Corona issue. The gmail app is altering your HTML text. We have no control over that. I find that the best thing to do is to change your HTML to use tags that the gmail app won’t alter. For example, the HTML e-mailed by our sample app “Networking/ComposeEmailSMS” does not get altered by gmail. [import]uid: 32256 topic_id: 34154 reply_id: 142668[/import]

I have circled back to this issue with HTML email on the Android and i am not convinced that there is not something wrong with the way that corona is passing the message off to the Android mail.  As far as i can tell from reading this simple html should work just fine but it does not.  

\<html\> \<head\> \</head\> \<body\> \<span style="font-family: monospace;"\>Column 1\</span\> \<span style="border: 5px solid gray; font-family: monospace;" width="200"\>Column 2\</span\> \<span style="font-family: monospace;" width="200"\>Column 3\</span\> \</body\> \</html\>

What gets sent in the email is:

Content-Type: multipart/alternative; boundary=047d7bf10b46fdaa8104e240f915 X-Gm-Message-State: ALoCoQl6l4sWHkUrwX6B6AYAjfx7QxLGxTSIgXDOpTlNKK7idF+FC523sr5KwbdaguhGD5mnOq6n --047d7bf10b46fdaa8104e240f915 Content-Type: text/plain; charset=ISO-8859-1 Column 1 Column 2 Column 3 --047d7bf10b46fdaa8104e240f915 Content-Type: text/html; charset=ISO-8859-1 \<p dir="ltr"\> Column 1 Column 2 Column 3 \</p\> --047d7bf10b46fdaa8104e240f915--

The multipart-alternative with the HTML part munged.  Can you please take a second look at this issue.

Cheers,

Marc

Corona is sending your HTML text as a string as-is to the e-mail app.  There’s really nothing for us to look at.  The e-mail client is altering it.  I suspect that you’ll see different results with different mail apps too.

I have circled back to this issue with HTML email on the Android and i am not convinced that there is not something wrong with the way that corona is passing the message off to the Android mail.  As far as i can tell from reading this simple html should work just fine but it does not.  

\<html\> \<head\> \</head\> \<body\> \<span style="font-family: monospace;"\>Column 1\</span\> \<span style="border: 5px solid gray; font-family: monospace;" width="200"\>Column 2\</span\> \<span style="font-family: monospace;" width="200"\>Column 3\</span\> \</body\> \</html\>

What gets sent in the email is:

Content-Type: multipart/alternative; boundary=047d7bf10b46fdaa8104e240f915 X-Gm-Message-State: ALoCoQl6l4sWHkUrwX6B6AYAjfx7QxLGxTSIgXDOpTlNKK7idF+FC523sr5KwbdaguhGD5mnOq6n --047d7bf10b46fdaa8104e240f915 Content-Type: text/plain; charset=ISO-8859-1 Column 1 Column 2 Column 3 --047d7bf10b46fdaa8104e240f915 Content-Type: text/html; charset=ISO-8859-1 \<p dir="ltr"\> Column 1 Column 2 Column 3 \</p\> --047d7bf10b46fdaa8104e240f915--

The multipart-alternative with the HTML part munged.  Can you please take a second look at this issue.

Cheers,

Marc

Corona is sending your HTML text as a string as-is to the e-mail app.  There’s really nothing for us to look at.  The e-mail client is altering it.  I suspect that you’ll see different results with different mail apps too.

I struggled with this as well.

gmail has very limited html formatting options, the rest gets stripped out or replaced with OBJ

<b>, <p> works, but if you want to embed a link, don’t put inside a HREF tag as gmail seems to do this for you.

I could not get an embedded image either, so for my usage I just attached an image file.

I struggled with this as well.

gmail has very limited html formatting options, the rest gets stripped out or replaced with OBJ

<b>, <p> works, but if you want to embed a link, don’t put inside a HREF tag as gmail seems to do this for you.

I could not get an embedded image either, so for my usage I just attached an image file.

Check this …HTML Email Tutorial

Lynda