【问题标题】:Calling the built in email app [duplicate]调用内置的电子邮件应用程序[重复]
【发布时间】:2018-09-30 03:58:13
【问题描述】:
Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND

intent.setType("text/plain");

intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
intent.putExtra(Intent.EXTRA_TEXT, "Body of email");
intent.setData(Uri.parse("mailto:default@recipient.com")); // or just "mailto:" for blank
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
startActivity(intent);

此方法调用内置电子邮件,但我想输入电子邮件地址和用户输入的邮件消息是否可以复制任何人都可以给我解决方案

【问题讨论】:

    标签: java android


    【解决方案1】:

    我使用此代码仅选择电子邮件应用程序并推送主题、文本和收件人:

    Intent emailIntent = new Intent(Intent.ACTION_SENDTO, 
    Uri.fromParts("mailto","your.email@example.com", null));
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
    emailIntent.putExtra(Intent.EXTRA_TEXT, "Body of email");
    startActivity(Intent.createChooser(emailIntent, "Send email..."));
    

    如果你不想要正文/主题,你可以把那一行去掉。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-20
      • 2010-12-20
      相关资源
      最近更新 更多