Johnny Rocket
Johnny Rocket

Reputation: 1434

Sending Email from Android Application

I am trying to add in the ability for users of my app to send feedback, and I found an example of how to do it, but the only downside is I don't like the fact that the Email activity seems to be pulling the users email address(I guess the one linked to their phone), and they are allowed to change the To: block. Here is the code I am using. Is there any way I can disable the To: field, and let me enter text into the from field? I'm guessing I would have to create an email address like "[email protected]" and use that as the generic email address?`

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);                    
            emailIntent.setType("plain/text");               
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ "[email protected]"});             
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "App Feedback");             
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "");     
            MainScreen.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

Upvotes: 0

Views: 1074

Answers (2)

droidster.me
droidster.me

Reputation: 558

Using this Intent you can mail in android default intent for mail.

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

Upvotes: 0

slybloty
slybloty

Reputation: 6516

Try Intent.ACTION_SENDTO instead. Use these links for more help: ACTION_SENDTO and link.

Upvotes: 1

Related Questions