发送电​​子邮件随着Android的唯一的电子邮件客户端应用程序应用程序、客户端、电子邮件、邮件

2023-09-06 15:57:00 作者:失夜 ?Sakitama

我想实现一个选项,以发送电子邮件。现在我可以发送电子邮件,但问题是,Android的显示许多应用程序发送诸如不需要蓝牙,Facebook,邮件等。我要避免这种情况,仅显示电子邮件客户端应用程序。

 意向意图=新意图(Intent.ACTION_SEND);的String [] =电子邮件{suresh.chandani@gmail.com};intent.putExtra(Intent.EXTRA_EMAIL,电子邮件);intent.putExtra(Intent.EXTRA_STREAM,URI);intent.putExtra(Intent.EXTRA_SUBJECT,测试应用程序);intent.putExtra(Intent.EXTRA_TEXT,电子邮件正文);intent.setType(信息/ RFC822);startActivity(意向); 

如果任何人知道如何做到这一点请让我知道

解决方案

 意向意图=新意图(Intent.ACTION_SENDTO,Uri.parse(电子邮件地址:suresh.chandani@gmail.com );intent.putExtra(Intent.EXTRA_SUBJECT,测试应用程序);intent.putExtra(Intent.EXTRA_TEXT,电子邮件正文);startActivity(意向); 

幸得亚当斯兄弟博客,但他确实在他的文章提到,这只是工作的Gmail他。看看你是否有任何与它的成功。他确实表明这样做是为他工作的另一种方式。

I want to implement an option to send email. Right now i can send email but problem is, Android shows many applications to send such as bluetooth, facebook, message,etc which is not required. I need to avoid this and show only email client application.

Intent intent = new Intent(Intent.ACTION_SEND); 
String[] emails = {"suresh.chandani@gmail.com"}; 
intent.putExtra(Intent.EXTRA_EMAIL, emails); 
intent.putExtra(Intent.EXTRA_STREAM, uri); 
intent.putExtra(Intent.EXTRA_SUBJECT, "Test App"); 
intent.putExtra(Intent.EXTRA_TEXT, "Email Body"); 
intent.setType("message/rfc822"); 
startActivity(intent);

If any one knows to how to achieve this please let me know

解决方案

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:suresh.chandani@gmail.com);    
intent.putExtra(Intent.EXTRA_SUBJECT, "Test App");  
intent.putExtra(Intent.EXTRA_TEXT, "Email Body");
startActivity(intent);

Credit goes to Adams Bros Blogs but he does mention in his post that this only worked for gmail for him. See if you have any success with it. He does show another way of doing this that worked for him.