电子邮件活动 [英] Email activity

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

问题描述

我想从android虚拟机发送电子邮件到我的Gmail帐户。
问题:但按下发送按钮后,我得到了没有应用程序可以执行此操作。

我做错了什么?



这是我的代码:

 
意图sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType(audio / mp3);
//sendIntent.putExtra(Intent.EXTRA_STREAM,file:///sdcard/mysong.mp3);
//sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(file:///sdcard/download/test.mp3));
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(GlobalVariable.getstrEmail()));
sendIntent.putExtra(Intent.EXTRA_SUBJECT,Subject);
startActivity(Intent.createChooser(sendIntent,Title:));


解决方案

试试真正的设备本身,它应该可以工作。您需要更改类型:

  final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
emailIntent.setType(plain / text);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String [] {email@example.com});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,body text);
startActivity(Intent.createChooser(emailIntent,发送邮件...));


I want to send email from android virtual machine to my gmail account. Problem: but on pressing send button i am getting "No application can perform this action".

What am I doing wrong?

Here is my code:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("audio/mp3");
//sendIntent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
//sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/download/test.mp3")); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(GlobalVariable.getstrEmail())); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
startActivity(Intent.createChooser(sendIntent, "Title:")); 

解决方案

Try it on a real device itself, it should work. And you need to change the type:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"email@example.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "body text");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));

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

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