Home » Java » How to send “values” (string/ integer) from my app to my Gmail account without Java.Mail API?

How to send “values” (string/ integer) from my app to my Gmail account without Java.Mail API?

Posted by: admin October 26, 2017 Leave a comment

Questions:

I am creating an application from which i want to send some values to my Gmail account. Like, sending mail without user interaction or sending mail in the background.Is it possible to achieve it using intent?

Answers:

Below is the code I am sharing to send subject and content to gmail app.

feedbackSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
                        "mailto","[email protected]", null));
                intent.putExtra(Intent.EXTRA_SUBJECT, "Feedback");
                //intent.putExtra(Intent.EXTRA_TEXT, feedbackContent.getText().toString());
                intent.putExtra(Intent.EXTRA_TEXT, "App Quality : "+ rate_no + "\n\n\n Comment :\n" + feedbackContent.getText().toString());
                startActivity(Intent.createChooser(intent, "Choose an Email client :"));
                finish();
            }
        });

If you want any other help then you can share your problem to me at : [email protected]