table in e-mail in HTML format (Email.GetHtmlIntent)

raphaelcno

Active Member
Licensed User
Longtime User
Is there some restrictions regarding which HTML tags we can use in an e-mail content sent with Email.GetHtmlIntent?
I can use <b> without problem, but <table><tr><td>...</td></tr></table> does not work.
 

raphaelcno

Active Member
Licensed User
Longtime User
What do you mean with "does not work"?
Any errors?

If I have this code:
B4X:
Message.Body = "Normal <b>Bold</b> Normal<br />" & _
"Normal <b>Bold</b> Normal<br />" & _
"<table>" & _
"<tr><td>1</td><td>2</td></tr>" & _
"<tr><td>33333333333</td><td>444444444</td></tr>" & _
"</table>" & _
"Normal <b>Bold</b> Normal<br />" & _
"Normal <b>Bold</b> Normal<br />"

StartActivity(Message.GetHtmlIntent)

I receive an e-mail with this content:
Normal Bold Normal
Normal Bold Normal
1233333333333444444444Normal Bold Normal
Normal Bold Normal

The text in bold is in bold, but the text in table (1 / 2 / 3333 / 4444) is not in a table.
 
Upvote 0

raphaelcno

Active Member
Licensed User
Longtime User
OK, thank you for the information.
Do you know if there is another way to align text in columns without using a table?
 
Upvote 0

Jost aus Soest

Active Member
Licensed User
Longtime User
In real world HTML pages I use CSS for such formatting (width and alignment).
But unfortunately Android has also an limitation in CSS support.
 
Upvote 0

ChrShe

Member
Licensed User
Longtime User
Upvote 0

raphaelcno

Active Member
Licensed User
Longtime User
Maybe I misunderstand your explanation, but what I would like to do is to put a table in the message body (not attachment). Can this be done with your code ?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
If you want to put a table in the MESSAGE-BODY then the message body have to be a Content-Type of

"Content-type: text/html; charset=iso-8859-1\r\n"

in the header...


But, i´m sorry, i dont know how to do that with android... If i want to send html-email i would do it with PHP and a good php-mailer-class...
 
Upvote 0

gnadkiran

New Member
Licensed User
Longtime User
Hi everyone ,

I need some help , im sending an email from my app,it succefully sends it but the styles do not render. Im sending the mail in the message body as below:


B4X:
SMTP.To.Add("xxxxx@gmail.com")
SMTP.Subject = "HTML email testing "
SMTP.HtmlBody = True            
SMTP.Body = functionToGetHTMLcontent
SMTP.send

Below is the function to get the HTML content :

B4X:
Sub functionToGetHTMLcontent As  String
    Dim sb As StringBuilder
    sb.Initialize
    sb.Append("<html><!DOCTYPE html><html><body><table align='left' border='1' cellpadding='1' cellspacing='0'  width='100%'>")
    sb.Append("<tbody>")
  
    ''---RED--------------------------------------------------------------------------------------------
      sb.Append("<tr height='30'>")
      sb.Append("<td style='width=5%' bgcolor=#FE2121  align='center'><font COLOR=#FFFFFF><b>") ''#FE2121
      sb.Append("No.</b></font></td>")
      sb.Append("<td style='width: 95%' bgcolor=#FE2121><font COLOR=#FFFFFF><b>")
      sb.Append("Title 1</b></font></td>")
      sb.Append("</tr>")
      sb.Append("</tbody>")
      sb.Append("</table><br><br><strong>Note:</strong><br/> Click <strong>[Reply All]</strong> to respond to this mail.</body><html><br><br><br>")
  Return sb.ToString
End Sub

The result which I receive in my mail as below (The size of table is output correctly but the font (white) and background color (red) do not get displayed )

No.Title 1

Note:
Click [Reply All] to respond to this mail



Is there any property that i need to add , maybe the "Content-type: text/html" anywhere ?
Thanks in advance.
 
Last edited:
Upvote 0

raphaelcno

Active Member
Licensed User
Longtime User
I don't know if there is any relation with your problem, but it seems like you forgot to write "</b>" before "</font>".
 
Upvote 0

gnadkiran

New Member
Licensed User
Longtime User
raphaelcno thanks for your reply, but adding the </b> did not change the result..

Ive edited my first post tho, without the </b> it still do makes the words bold but nevertheless ive add it to retain good html formatting .

Ive tested it in from emulator , HTC One 8 and Tablet 1.0 - same result.
Any other suggestions ?
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…