我正在尝试使用HTML正文发送电子邮件。 我有一个包含一些有效的HTML的字符串:发送包含HTML内容的电子邮件
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
</head>
<body>%s</body>
</html>
从我被一些HTML取代%S。
然后我尝试用下面的代码发送此作为一个HTML电子邮件:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, myhtmlcontent);
context.startActivity(Intent.createChooser(intent, context.getText(R.string.share)));
但我只收到HTML源代码以纯文本
现在如果我更换
intent.putExtra(Intent.EXTRA_TEXT, myhtmlcontent);
与
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(myhtmlcontent));
我收到一封有效的HTML电子邮件,但我的所有图片已被替换为某些特殊字符。有没有办法保留我的原始HTML内容并将其显示为HTML电子邮件?
这里是我完整的HTML代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body><p><a href="http://www.dailymars.net/wp-content/uploads/2014/05/Ant-Man.jpg"><img
class="aligncenter size-full wp-image-55602"
src="http://www.dailymars.net/wp-content/uploads/2014/05/Ant-Man.jpg" alt="Ant-Man"
width="720" height="302"/></a></p>
<p>Les enfants, l’heure est grave. Vous l’avez compris car vous l’avez lu dans le
titre de la news (eh ouaip!), <strong>Edgar Wright</strong> ne réalisera finalement pas <em>Ant
Man</em>. Alors qu’il était rattaché au projet depuis 2006 et qu’il en avait
écrit le scénario avec <strong>Joe Cornish</strong>, <strong>Marvel </strong>a annoncé que le
réal avait quitté le navire. La faute à quoi? Des « différences créatives »,
soit la meilleure excuse qu’Hollywood aie jamais inventé.</p>
<p><strong>Marvel </strong>a par ailleurs ajouté que le départ de <strong>Wright </strong> ne
changerait rien au casting ni à la date de sortie du film et qu’un remplaçant, dont le nom
devrait bientôt tomber, avait déjà été engagé. Dommage, ça n’aura pas la même saveur.</p>
<p><em>Ant Man</em> avec <strong>Paul Rudd, Michael Douglas, Evangeline Lilly, Corey Stoll, Michael
Pena</strong> et <strong>Patrick Wilson.</strong> Mais sans <strong>Edgar Wright</strong>.
Sortie en juillet 2015</p>
<p style="text-align: right;"><em>Source: <a
href="http://variety.com/2014/film/news/edgar-wright-leaves-marvels-ant-man-1201190458/">Variety</a></em>
</p>
</body>
</html>
看看这个:http://stackoverflow.com/a/5216927/812598 – GoRoS
它没有帮助。我知道显示图像将要求用户接受它。我的问题是,我要么收到我的html源代码作为纯文本或我收到的HTML,但图像被剥离了Html.fromHtml()... – user1026605