开发者

unable to send email from my application

I have a requirement that I need to send email from my application, I am using below code to send email...

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("Text/Plain");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{abc@gmail.com});
    intent.putExtra(Intent.EXTRA_TEXT, "hello..");
    startActivity(Intent.createChooser(intent, email_cho开发者_运维问答oser_title));

The above code launching the email composer. But after I press on send button , I can see one toast message "Message Sending" , But my message not sent.

pl. help me to figure out where I did wrong in this, or let me know if any alternative to solve this.. thanks.


   Intent i = new Intent(Intent.ACTION_SEND);
    //i.setType("text/plain"); //use this line for testing in the emulator
    i.setType("message/rfc822") ; // use from live device
    i.putExtra(Intent.EXTRA_EMAIL, new String[]{"test@gmail.com"});
    i.putExtra(Intent.EXTRA_SUBJECT,"subject goes here");
    i.putExtra(Intent.EXTRA_TEXT,"body goes here");
    startActivity(Intent.createChooser(i, "Select email application."));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜