How to send Email in Android

In Android, you can use Intent.ACTION_SEND to call an existing email client to send an Email.

See following code snippets :

	Intent email = new Intent(Intent.ACTION_SEND);
	email.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});		  
	email.putExtra(Intent.EXTRA_SUBJECT, "subject");
	email.putExtra(Intent.EXTRA_TEXT, "message");
	startActivity(Intent.createChooser(email, "Choose an Email client :"));

P.S This project is developed in Eclipse 3.7, and tested with Samsung Galaxy S2 (Android 2.3.3).

Run & test on real device only.
If you run this on emulator, you will hit error message : “No application can perform this action“. This code only work on real device.

1. Android Layout

File : res/layout/main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
    android:orientation="vertical" >
        android:text="To : "
        android:textAppearance="?android:attr/textAppearanceLarge" />
        android:inputType="textEmailAddress" >
        <requestFocus />
        android:text="Subject : "
        android:textAppearance="?android:attr/textAppearanceLarge" />
        android:text="Message : "
        android:textAppearance="?android:attr/textAppearanceLarge" />
        android:lines="5" />
        android:text="Send" />

2. Activity

Full activity class to send an Email. Read the onClick() method, it should be self-explanatory.

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class SendEmailActivity extends Activity {
	Button buttonSend;
	EditText textTo;
	EditText textSubject;
	EditText textMessage;
	public void onCreate(Bundle savedInstanceState) {
		buttonSend = (Button) findViewById(;
		textTo = (EditText) findViewById(;
		textSubject = (EditText) findViewById(;
		textMessage = (EditText) findViewById(;
		buttonSend.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
			  String to = textTo.getText().toString();
			  String subject = textSubject.getText().toString();
			  String message = textMessage.getText().toString();
			  Intent email = new Intent(Intent.ACTION_SEND);
			  email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});
			  //email.putExtra(Intent.EXTRA_CC, new String[]{ to});
			  //email.putExtra(Intent.EXTRA_BCC, new String[]{to});
			  email.putExtra(Intent.EXTRA_SUBJECT, subject);
			  email.putExtra(Intent.EXTRA_TEXT, message);
			  //need this to prompts email client only
			  startActivity(Intent.createChooser(email, "Choose an Email client :"));

3. Demo

See default scree, fill in the detail, and click on the “send” button.

send email in android

It will prompts your existing Email client to select.

send email in android

In this case, i selected Gmail, and all previous filled in detail will be populated to Gmail client automatically.

send email in android
Android does not provide API to send Email directly, you have to call the existing Email client to send Email.

Download Source Code

Download it – (16 KB)


  1. Android Intent ACTION_SEND Javadoc
Tags :

About the Author

Founder of and, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.


  • Pingback: streaming movies()

  • Pingback: watch movies online free()

  • Pingback: free weight loss ebook()

  • Pingback: Blue Coaster33()

  • Aruna

    your examples very useful to me.

    thank you for sharing your knowledge.

  • balaji

    hey its work fine but its not getting the to,subject,message field to the gmail to,subject,message field can any one just help me to sort it out

  • surya

    hi i want a mail app with any mail client.i dont have any applications in device.can tell me how can i implement it.

  • Emre

    How do it know your email address?I can see another email address but yours can’t.

  • ali

    hi how to create live wallpaper for android plz give example

  • Monica

    Thanks!! it really helped!!

  • ayaz

    error after clicking send button chose an email client :
    no application can perform this action plzz help thanks

    • Vicente

      You should try this on a real device because the emulator won’t be able to start the activity.

  • Sailen


    can any one tell me how can i set the Email client for this application.

  • David McGuinness


    thanks very much, excellent tutorial. works really well. however is it possible to have numerous message fields in place of just the one message text area. I was hoping that the user would be able to populate numerous fields and when the email was read by the recipient the messages would be read as one full message.

    thanks in advance


  • mahak

    hey how can i change the target phone i android 2.2.1… and it is not running on that. how do i solve that?

  • nero

    thank you very much :)

  • kuldeep

    i waant to get senders email address from recieved can i get that ?

  • farhan shah

    Nice and Awsome Tutorials..Thumbs up!

  • Pingback: Sending Emails in android app : Android Community - For Application Development()

  • Johan

    When click on the send button I only can choose Gmail and not my regular mail client

  • mursid

    thats really awsome thx so much dude ..!

  • beth

    amazing sit.great help! thanks :)

  • Abhay

    How to save the form data in database when button is clicked?

    and that form data have to be mailed to admin.

  • Ali
  • manikanta

    me also got the output….

  • meziane

    why the app generate error when i use 1.6 version of sdk

  • vyshak

    its really awsme….i get the output try to put some more apps

  • chintan

    hi i want to send mail with CC . and CC ID should be sender’s id. so it can be any either gmail of email so how i get it . can you help me about that .

    i have try with accounmanager with GET_ACCOUNTS permission in manifest.
    referance :

  • tARUN

    This is g8 site where i have been learning so many things regarding java, android with in easy manner and example also. I think this is r8 way to teach. And you have been working hard to do so. Thanks a lot.

  • Andrew

    Can you please make a tutorial for sending email with attachment ?

  • Piyush

    Hello sir gr8 tutorial for but it would be greatful if u post one of the code how to send e-mail with attachment..

  • prasad


    can you please tell me how to run android app always on background.
    i am trying to listen all incoming sms and calls..

    thank you..

  • Udhay

    Hey MKYong,
    I just added few features to the ‘Email’ application like validation, enhanced form submission etc., Here is the post: Welcome your comments!

  • sachin

    nice website….!!

  • Hassan

    Thanks for the tutorial.
    Do we have to make changing in android manifest file too?

  • Kislay

    Hello can you tell me how can I send html through email, with some style defined into span????
    I have read a lot of forums they simply talks about tagHandler but their is very less information regarding this on internet.

  • Wayne Collins

    If I only have one email client on the device the chooser does not appear, it goes straight to the one and only email client configured. That is fine. The problem is Intent.createChooser() has an IntentReceiver that is leaking and fills logcat with error messages. This works fine on the emulator if I configure the email client. Is there a way to startActivity() without calling Intent.createChooser()?

  • RobertDraven

    hi thanks for this code, that’s useful.
    But I have a question, there is some way of automatically sending??

  • sailam

    Ay chooseb an email client:
    I am getting an exception as “No apllication can perform this action”….
    Is it possible to send a mail using this app code?

    • mkyong

      This code only collect your fill in form data and pass it to your existing email client in your phone. Please choose an email client which is able to send email.

  • Rukmal Dias

    I tried this email.setType(“message/rfc822″), but it shows skype with other email clients.. Hoe remove skype from there ?

    • Said Lamkur

      Deal with it