我正在尝试使用 Intent 发送 html 邮件。在作曲家中,它以 html 格式显示,但在收件人端,它显示为普通文本。我必须发送带有超链接的图像和文本。作曲家的屏幕截图是这样的
以下是我迄今为止尝试过的,
public class Sendingamail extends Activity {
/** Called when the activity is first created. */
Button send;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
send=(Button) findViewById(R.id.emailsendbutton);
send.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
String html = "<!DOCTYPE html><html><body><a href=\"http://www.google.com\">Visit W3Schools.com!</a>" + "<p>If you set the target attribute to \"_blank\", the link will open in a new browser window/tab.</p></body></html>";
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hhhhhhhh");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(html));
Sendingamail.this.startActivity(emailIntent);
});
}
}