Android电子邮件发送验证 [英] Android e-mail sending verification

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

问题描述

我使用下面的代码发送电子邮件到电子邮件地址。当我点击发送按钮,有一个吐司msg说消息发送...,但我没有在代码中。它必须是默认值。我的问题是,这是说消息是发送的,但没有说明发送的信息。我知道它不能检查是否到达,但应该有一个msg说它发送。我希望它没有发送时显示错误,但用户不知道这一点。

  Intent i = new Intent Intent.ACTION_SEND); 
i.setType(text / plain);
i.putExtra(Intent.EXTRA_EMAIL,new String [] {something@gmail.com});
i.putExtra(Intent.EXTRA_SUBJECT,电子邮件主题);
i.putExtra(Intent.EXTRA_TEXT,body of email);
try {
startActivity(Intent.createChooser(i,Send mail ...));
} catch(android.content.ActivityNotFoundException ex){
Toast.makeText(About.This,没有安装电子邮件客户端),Toast.LENGTH_SHORT).show();
}

谢谢

解决方案

这不能完成。由于任何应用程序都可以对Intent进行响应,因此不保证任何结果代码或结果意图。



请参阅:



在OnActivityResultAndroid中获取邮件发送通知



请参阅:



简单:获取电子邮件确认在Android中发送



我自己对ICS的个人测试显示,无论用户是按下还是发送,电子邮件客户端都为0返回resultCode。 p>

I use the code below to send an e-mail to may e-mail address. When i click the send button, there's a toast msg saying Message send..., however i don't have it in the code. It must be default. My problem is that this is saying that the message is to be sent but does not say anything about that it was sent. I know it cannot be checked if it arrived, but there should be a msg saying it' s sent. I hope it shows an error when it is not sent, but the users do not know this.

Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"something@gmail.com"});
        i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
        i.putExtra(Intent.EXTRA_TEXT   , "body of email");
        try {
           startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
           Toast.makeText(About.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        }

thanks

解决方案

This cannot be done. Since any application can respond to the Intent there is no guarantee of any result code or result intent.

See:

Get Mail Sent Notification in onActivityResult "Android"

See:

Trivial: Get confirmation of email sent in android

My own personal tests on ICS are showing both email clients returning 0 for the resultCode regardless of whether the user presses back or send.

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

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