开发者

How to know if the email is really sent?

In my app, the user can decide to send an email to a friend just pressing a button "send mail". After that, my applications send the email. Here is the problem: the email cannot be sent automatically... for example, if the user has more email 开发者_开发问答clients installed, the operating system will ask him which client use for sending email... And, most important, the user can decide to change idea and no more send the email...

So, the question: How to count the amount of sent emails? It is NOT correct to count the number of clicks of the button: I need to test if the email has been REALLY sent...

But... How?


How to count the amount of sent emails?

You don't. That is up to the user. Design your app such that you do not care if the user sends the email or not.

If the nature of your application is such that you absolutely have to know whether the email is sent, embed email sending straight into your application. There is a JavaMail port for Android floating around somewhere, IIRC. This may require you to get the user's email account and password, which they will not want to give you. Hence, I recommend that you design your app such that you do not care if the user sends the email or not.


Seen that it's not possible using embedded email system, but seen that it's necessary keep count, I suggest using this class that send the email without promting.

For the first mail sent, user must input account username and password (be careful, read CommonsWare comment...), that can be stored encrypted with this class in the private structure SharedPreferences.

So, due to the fact that the mail is sent programmatically, if the statement of the mail-sending doesn't throw any exception, we can consider the mail as sent...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜