Android Question Email and HTML

Discussion in 'Android Questions' started by AlpVir, Jun 22, 2015.

  1. AlpVir

    AlpVir Well-Known Member Licensed User

    How to send an email that contains the HTML code ?
    Code:
    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
     
  2. NJDude

    NJDude Expert Licensed User

    If you look above, under SIMILAR THREADS, you will find several posts addressing this issue.
     
    thedesolatesoul and lemonisdead like this.
  3. AlpVir

    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.
     
  4. sorex

    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.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Your code is correct (though you are calling GetHtmlIntent twice for some reason).

    Try it with a simple html: <b>Hello</b> world.
     
  6. AlpVir

    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.
    Code:
    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.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    If you check the raw message received in your mail client you will see that the html is sent as is. Maybe your mail client doesn't support tables.
     
  8. AlpVir

    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.
    Code:
    Message.Body="<html><body><img src=" & Chr(34) & "file://" & File.DirAssets & "/Classe.png" & Chr(34) & "></body></html>"
    How to fix it (formatted text only)?
     
  9. sorex

    sorex Expert Licensed User

    and how will people see the image that is on your phone?
     
    thedesolatesoul and DonManfred like this.
  10. AlpVir

    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 !


    [​IMG]
     
  11. DonManfred

    DonManfred Expert Licensed User

    Store the images on your server and inside your html code you load the image from the absolute url on your server.
     
  12. sorex

    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.
     
  13. AlpVir

    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.) ?
     
  14. sorex

    sorex Expert Licensed User

    it shouldn't be, it's just text.

    I'll see if I can test this here.
     
  15. AlpVir

    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
     
  16. sorex

    sorex Expert Licensed User

    will check at home, Win8.1 on my new desktop at work doesn't recognize my phone.
     
  17. picenainformatica

    picenainformatica Active Member Licensed User

    Code:
    message.htmlbody=true
     
  18. sorex

    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.
     
  19. AlpVir

    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.
     
  20. sorex

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice