【问题标题】:android app email compose - how to automatically "Send" the emailandroid app email compose - 如何自动“发送”电子邮件
【发布时间】:2015-03-23 10:14:55
【问题描述】:

我正在尝试在我的桌子上的 android 应用程序中使用本机电子邮件撰写,以便在应用程序崩溃时向我发送日志。

下面的代码运行良好,但会弹出原生电子邮件撰写,您必须按发送。有没有办法告诉撰写应用程序只是发送电子邮件。无需手动点击即可发送?

Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
 intent.setType("message/rfc822");

 intent.setType("text/plain");
 intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
 intent.putExtra(Intent.EXTRA_TEXT,    "Body of email");
 intent.setData(Uri.parse("myeamil@yahoo.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);

谢谢。 最大

【问题讨论】:

    标签: android email


    【解决方案1】:

    您应该尝试this questionthis tutorial 了解更多详情

    【讨论】:

    • stackoverflow.com/questions/15055927/send-email-in-android-app/… - 我找到了这个,但它看起来像我需要的,但我不知道我需要如何调用它。另一个问题是您仍然必须按下发送按钮我希望这会自动发生。
    • 我不明白为什么你必须按上面答案的发送按钮。您只需要创建一个线程并调用 email.send()
    • 我想从我的应用程序的几个课程中调用。如果应用程序崩溃,我想向我发送日志文件。我假设当您说 email.send 时,您正在谈论第二组代码。首先我必须按下按钮。我正在寻找一种方法来向 gmail 发送点击或命令,告诉它发送电子邮件,而不必在按钮出现时手动按下
    猜你喜欢
    • 2014-01-15
    • 2020-06-10
    • 2013-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多