Send HTML email with Gmail 4.2.1

前端 未结 4 1551
眼角桃花
眼角桃花 2020-12-14 01:35

It seems that Gmail 4.2.1 may have broken HTML-formatted emails. The following code worked perfectly prior to 4.2.1. The email that was sent from Gmail had the desired emb

相关标签:
4条回答
  • 2020-12-14 02:14

    I'm sorry that you ran into this too Scott. I filed a bug report with Google in December but that just seems to be a black hole.

    My need was to embed hyperlinks. My best work-around has been to send a text/plain or message/rfc822 email with the URL in plain text in the message. Oddly Gmail recognizes this and attempts to enclose it in < a > < /a > tags. Using this method I can get the link sent and clickable by the recipient but it looks like crap.

    It's also a bit of a challenge to get the URL formatted such that Gmail recognizes the entire text of the link and properly encloses it.

    0 讨论(0)
  • 2020-12-14 02:23

    This was almost certainly a bug in GMail 4.2.1.

    As of March 19, 2013, GMail 4.3 was released which appears to fix the bug.

    0 讨论(0)
  • 2020-12-14 02:26

    After reading your question i have surfed a lot for this issue and i found it here.It actually shows the way of and reason of formatting the Gmail body. You can checkout link also.

    I hope it will help you .

    Thanks.

    0 讨论(0)
  • 2020-12-14 02:30
    private void sendMail(String appName, String playStoreLink) {
        String msg = "<HTML><BODY>Hello,<br>Recently,I downloaded <b><font color=\"red\">"+appName+"</font></b>"+
    " from Play Store.I found this very challenging and a great game."+
                "<br>I would like to suggest you this game.<br><br><a href="+playStoreLink+">Download</a><br><br>"+
    "<br>Thank You</BODY></HTML>";
        String sub = "Get it now. It is there in Play Store";
        Intent email = new Intent(Intent.ACTION_SEND);
        email.setType("text/html");
        email.putExtra(Intent.EXTRA_SUBJECT, sub);
        email.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(msg));
        email.setType("message/rfc822");
        startActivity(Intent.createChooser(email, "Choose an Email client :"));
    }
    
    0 讨论(0)
提交回复
热议问题