android - How to send HTML email -
i found way send plain text email using intent:
final intent emailintent = new intent(android.content.intent.action_send); emailintent.settype("text/plain"); emailintent.putextra(android.content.intent.extra_email, new string[]{"example@mail.com"}); emailintent.putextra(android.content.intent.extra_subject, "subject"); emailintent.putextra(android.content.intent.extra_text, "test");
but need send html formatted text. trying settype("text/html") doesn't work.
you can pass spanned
text in extra. ensure intent resolves activities handle email (e.g. gmail , email apps), can utilize action_sendto
uri origin mailto scheme. work if don't know recipient beforehand:
final intent shareintent = new intent(intent.action_sendto, uri.parse("mailto:")); shareintent.putextra(intent.extra_subject, "the subject"); shareintent.putextra( intent.extra_text, html.fromhtml(new stringbuilder() .append("<p><b>some content</b></p>") .append("<small><p>more content</p></small>") .tostring()) );
android email android-intent html-email
No comments:
Post a Comment