Question

In my app I have an option, "Contact us", but anyway, I would like that the user to not see the email address where they send the email. I use the standard way to send the email, but however I build the interface, when the Email Client starts the destination email is shown.

Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("message/rfc822");
            i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"myemail@gmail.com"});
            i.putExtra(Intent.EXTRA_SUBJECT, "Subject");
            //i.putExtra(Intent.EXTRA_TEXT   , "emailBody");
            try {
                startActivity(Intent.createChooser(i, "Send mail..."));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(SecondActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
            }

I would like that myemail@gmail.com to be undisclosed to users. Over the internet we find this in many cases, where just a button "Send" is provided, for example, but how could we do this on Android?

Was it helpful?

Solution

I would like that myemail@gmail.com to be undisclosed to users.

If you wish to use ACTION_SEND, the user has the right to know the content they are sending and the email address they are sending it to, and to modify any of that as they see fit. It is their device, their email account doing the sending, and their bandwidth that is being consumed.

Over the internet we find this in many cases, where just a button "Send" is provided

The Web server is sending the email, rather than asking the user's browser to send the email.

how could we do this on Android?

You are welcome to find a JavaMail port for Android, or an equivalent library, and send the email directly yourself. Of course, you will need to configure your app to know an SMTP relay that you can use to do the sending.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top