电子邮件的字段/关键字是什么?

时间:2014-08-27 08:49:52

标签: android

我正在创建一个应用来为电子邮件生成QR码。为此,我需要知道像地址这样的关键字是“mailto:”。我想知道 cc,bcc,主题和消息的关键字

contents = "mailto:";

            String to = bundle.getString(Intent.EXTRA_EMAIL);
            String cc = bundle.getString(Intent.EXTRA_CC);
            String bcc = bundle.getString(Intent.EXTRA_BCC);
            String subject = bundle.getString(Intent.EXTRA_SUBJECT);
            String mailText = bundle.getString(Intent.EXTRA_TEXT);

            if (!to.isEmpty() && !subject.isEmpty() && !mailText.isEmpty()) {

                contents = contents + to + "\n";

                if (!cc.isEmpty() && !bcc.isEmpty()) {
                    contents = "cc:" + cc + "\n";
                    contents = "bcc:" + bcc + "\n";
                }
                contents = "subject:" + subject + "\n";
                contents = "message:" + mailText;
            }

我想创建我的内容字符串的关键字

2 个答案:

答案 0 :(得分:0)

使用此方法:

public static Intent email(Context context, String[] to, String [] cc, String [] bcc, String subject, String body, Uri attachment) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:"));
    if (to != null)
        intent.putExtra(Intent.EXTRA_EMAIL, to);
    if (cc != null)
        intent.putExtra(Intent.EXTRA_CC, cc);
    if (bcc != null)
        intent.putExtra(Intent.EXTRA_BCC, bcc);
    if (body != null)
        intent.putExtra(Intent.EXTRA_TEXT, body);
    if (subject != null)
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    if (attachment != null)
        intent.putExtra(Intent.EXTRA_STREAM, attachment);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

答案 1 :(得分:0)

Atlast我找到了解决方案。为电子邮件生成QR码的正确格式是,

要将电子邮件编写为QR码,您需要按以下格式编写:

MATMSG:TO:john@example.com;

SUB:我对你的故事的评论;

BODY:我刚读完你关于二维码的故事。谢谢;;

注意分号