我想以编程方式发送电子邮件。
我尝试了以下代码。
最终意图 emailIntent = 新意图(
android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { "[email protected] /cdn-cgi/l/email-protection" });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Email Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
"Email Body");
startActivity(Intent.createChooser(
emailIntent, "Send mail..."));
但问题是,在发送电子邮件之前,应用程序打开活动
我想直接发送电子邮件而不打开撰写活动。这怎么可能?
引用的链接有正确答案,但有写一些图书馆使你的工作轻松.
- https://github.com/yesidlazaro/GmailBackground https://github.com/yesidlazaro/GmailBackground
- https://github.com/thegenuinegourav/Android-Email-App-using-Javamail-Api https://github.com/thegenuinegourav/Android-Email-App-using-Javamail-Api
- https://github.com/prashantwosti/BackgroundMailLibrary https://github.com/prashantwosti/BackgroundMailLibrary
因此,不要再次编写所有代码,只需使用这些库中的任何一个即可在很短的时间内完成您的工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)