Android Question Email and HTML

AlpVir

Well-Known Member
Licensed User
How to send an email that contains the HTML code ?
B4X:
Dim Message As Email
Message.To.Add("alfa@site.com")   
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
 

AlpVir

Well-Known Member
Licensed User
Thanks but I have read many posts on this topic but I could not finish anything.
For this reason that I ask for help.
 

sorex

Expert
Licensed 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.
 

AlpVir

Well-Known Member
Licensed 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.
 

AlpVir

Well-Known Member
Licensed 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)?
 

AlpVir

Well-Known Member
Licensed 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 !


 

sorex

Expert
Licensed 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.
 

AlpVir

Well-Known Member
Licensed User
There is no server on which to store the image.
The image created on the fly from the app, should be sent via email.
It 's really impossible to send an email with the text (body) in HTML (<TABLE> <TR>, etc.) ?
 

AlpVir

Well-Known Member
Licensed User
Thank you.
I repeat: in Message.body you can insert tags such as <TABLE> or <TR>.
They are ignored; this is what I could understand / experience so far
I use Android 2.3.3
 

sorex

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

sorex

Expert
Licensed 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.
 

AlpVir

Well-Known Member
Licensed User
@picenainformatica
The Email object has no property HTMLBody.
The object SMTP instead have it.
I, however, I have to use an object Email.
 

sorex

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