Android sending email from code

Android sending email

Android Sending Email

Sending email from the android app is necessary task. It helps your users to easily contact you.

For sending email we will use our app to share data to mail client.(like Gmail android app).

The Intent object in android with proper action (ACTION_SEND) and data will help us to launch the available email clients to send an email in our application.

In android, Intent is a messaging object which is used to request an action from another app component such as activities, services, broadcast receivers and content providers.

To send an email you need to specify mailto: as URI using setData() method and data type will be to text/plain using setType() method as follows −

Below is the sample code to send the mail.

call this method inside class extending activity

 

 

Comments