自动发送电子邮件 [英] Sending an email automatically

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

问题描述

我得到了这个Bug列表活动在我的应用程序报告错误。有的EditText和按钮。我想按钮,发送电子邮件给我从文字的EditText。我使用了一些教程以及与此想出了:

I got this Bug list activity to report bugs in my apps. There is EditText and the button. I want the button to send email to me with text from EditText. I used some tutorial and came up with this:

        private void sendEmail() {
            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("text/plain");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, "myemail@gmail.com");
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "CFM - zgłoszenie");
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, description.getText());
            BugList.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
        }

但它只是打开空白ADDRES和主题字段emmail应用程序。我希望他们能够填补同上。

However it just opens emmail app with blank addres and subject field. I want them to be filled as above.

推荐答案

emailIntent.setType(纯/文);

的String [] {recipient@example.com}

emailIntent.setType("plain/text"); and String[]{"recipient@example.com"}

        private void sendEmail() {
        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.setType("plain/text");
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, String[]{"recipient@example.com"} );
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "CFM - zgłoszenie");
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, description.getText());
        BugList.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
    }

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

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