我可以使用哪种类型来发送带有 html 页面附件的电子邮件?无论我使用什么类型,发送的邮件都包含一个空页面作为附件
这是一些代码
String root = "/data/data/com.email/files/";
String fileName = "Payslip.html";
if (true) {
attachment = new File(root, fileName);
}
final Intent emailIntent = new Intent(
android.content.Intent.ACTION_SEND);
emailIntent.setType("application/octet-stream");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { address.getText().toString() });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
subject.getText());
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
emailtext.getText());
emailIntent.putExtra(Intent.EXTRA_STREAM,
Uri.fromFile(attachment));
EmailActivity.this.startActivity(Intent.createChooser(
emailIntent,
"Send mail..."));