在后台将数据发送到电子邮件 [英] send data to email in background

查看:28
本文介绍了在后台将数据发送到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过电子邮件 ID 发送消息数据.我创建了一个 mainActivity 类,其中包含一个 editText(用于 emailId)和一个按钮.另一个类是 BroadcastReceiver 类,我在其中检索数据.现在我不明白如何将该数据发送到后台提供的电子邮件.我用谷歌搜索了很多,但无法得到所需的回复.请分享想法并帮助我.

I am working on sending my message data on my email Id.I have made a mainActivity class containing an editText (for emailId) and a Button. Another class is BroadcastReceiver class in which I retrieve data. Now I can't understand how to send that data to the provided email in Background. I have googled a lot but can't get the required response. Please share the ideas and help me in it.

推荐答案

我为此创建了开源库.用法很简单:

I create open source library for this. Usage is very simple:

BackgroundMail bm = new BackgroundMail(context);
bm.setGmailUserName("yourgmail@gmail.com");
bm.setGmailPassword("yourgmailpassword");
bm.setMailTo("receiver@gmail.com");
bm.setFormSubject("Subject");
bm.setFormBody("Body");
bm.send();

拥有此权限

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/> 

你可以在这里下载:https://github.com/kristijandraca/BackgroundMailLibrary

这篇关于在后台将数据发送到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆