Stephen
Stephen

Reputation: 10079

send a message to client email address from my android application

ContactFragment.java:

view.findViewById(R.id.textView10).setOnClickListener(
                new OnClickListener() {

    @Override
    public void onClick(View v) {
        String name=edit1.getText().toString();       
        String e_mail = edit2.getText().toString();
        String subject = edit3.getText().toString();
        String message = edit4.getText().toString();

         Intent i = new Intent(Intent.ACTION_SEND);
         i.putExtra(Intent.EXTRA_EMAIL, e_mail);


        i.putExtra(Intent.EXTRA_TEXT, name);
         i.putExtra(Intent.EXTRA_SUBJECT, subject);
        i.putExtra(Intent.EXTRA_TEXT, message);


        //i.setType("message/rfc822");

        i.setData(Uri.parse("mailto:"+"[email protected]")); -->Client Email address for an example 

       //startActivity(Intent.createChooser(i, "Choose an Email client :"));
        }

    });

Upvotes: 0

Views: 89

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007544

If you are using mailto:, you need to use ACTION_SENDTO, not ACTION_SEND.

Beyond that, the user must send the email -- all ACTION_SEND and ACTION_SENDTO will do is set up the message in the user's email app's "composer".

Upvotes: 1

Related Questions