Android Question Email and HTML

AlpVir

Well-Known Member
Licensed User
Longtime User
How to send an email that contains the HTML code ?
B4X:
Dim Message As Email
Message.To.Add("[email protected]")   
Message.Subject = "Test html"
Message.Body = "<table><tr><td>Test <b>one</b></td></tr></table>"
Message.GetHtmlIntent
StartActivity(Message.GetHtmlIntent)
Despite numerous tests I have not achieved my goal.
Thanks in advance
 

sorex

Expert
Licensed User
Longtime User
you are missing the html & body tags to start with. not sure what else is needed to force it into html mode on android tho.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
After eliminating the double GetHtmlIntent the simple example <b> Hello </ b> works.
But it does not work with the tags table. This is very serious for me.
B4X:
Message.Body = "<table><tr><td><b>Hello</b></td></tr><tr><td>no bold</td></tr></table>"
Either by entering the tag <HTML> and <BODY> or <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'> or <!DOCTYPE html> ....
The use of the tables is essential for me.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
I do not know how to read the message in raw format.
I have read many post, according to which the <TABLE> tag is not processed by the email client. It seems that it only supported the <B> and <BR>
Having the need to send emails with formatted text I also thought of sending a single image that shows the screenshot of a table.
But even this seems to work.
B4X:
Message.Body="<html><body><img src=" & Chr(34) & "file://" & File.DirAssets & "/Classe.png" & Chr(34) & "></body></html>"
How to fix it (formatted text only)?
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
The image is created from the app by reading a db and is inserted in an email.
I attach an example that could be accomplished with a table.
Since it seems that the tables can not be sent with an email I thought it could conversely be sent image.
I would not use attachments.
With a table (<TABLE><TR> .......) would be much simpler !


TempScreenShot.png
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
or use a php script that send the mail after you posted your mail content to it.
disadvantage is you need to be online.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
will check at home, Win8.1 on my new desktop at work doesn't recognize my phone.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
ok, now I see what you are trying to do.

I think you're better of by sending the mail via an smtp server, I thought you were trying to do that already.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
the problem is that the mail client vary from device to device so it's not certain that it will always work.
 
Upvote 0
Top