在 Android 中发送邮件
我的应用程序是基于计划的应用程序。我想从设备上配置的默认帐户发送电子邮件。
每当我们设置任何时间表时,它都会在那时通知。当时我想将邮件发送给地址已在 Textview 中设置的收件人。 但是,这些过程必须在后台运行。
我如何通过通知时间并使用默认帐户发送邮件来完成此操作?
有人帮我做这个吗?
My application is Scheduled based app. I want to send email from default account which is configured on device.
Whenever we set any schedule, it'll notify by that time. In that time i want to send mail to receiver whose address already set in Textview. But, these process must run in Background.
How can i done this by that notifying time and sending mail with default account?
Anyone help me to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题的时间部分可以由
AlarmManager
处理。Android 没有“默认”电子邮件帐户的概念,主要是因为 Android 没有电子邮件的概念。电子邮件是由应用程序而不是操作系统提供的。此外,Android 设备上通常配备的电子邮件和 Gmail 应用程序都不支持第三方应用程序在后台发送电子邮件而无需用户参与。如果您确实想在后台发送电子邮件,则需要实现您自己的 SMTP/IMAP 客户端(例如,使用 JavaMail),或者让您的应用程序联系您创建的代表您发送电子邮件的某些 Web 服务。
The time portion your problem can be handled by
AlarmManager
.Android does not have the concept of a "default" email account, mostly because Android does not have the concept of email. Email is something provided by an application, not the operating system. Furthermore, neither the Email nor the Gmail apps that typically come on an Android device support third-party applications sending email in the background without user involvement. If you really want to send emails in the background, you will either need to implement your own SMTP/IMAP client (e.g., with JavaMail) or have your app contact some Web service that you create that sends the emails on your behalf.