Sending Email from Android App- Android Programming

send_email
 

Send email from your Android App

In this article, you are going to learn how to send email from your Android app. We are going to use Intent to send an email. A user can select from which client he/she wants to send the mail.

So what we are doing is, we are creating a project. There are three EditTexts and one Send button. Among three EditTexts, the first one is for the recipient email, the second one is for the Subject of the email and the third one is for the Message body. Now clicking on the send button the chooser dialog will pop up with the supported email clients. You can choose an email client from there.

send_email

Note: This project doesn’t send email directly without an email client. If we do so, we have to ask email id and PASSWORD of the email id from the user. And no one will enter their email password there. But still, if you need I will make a separate post on how to send email directly from your app. Let me know in the comment section.

Google map integration – Android

YouTube search from your App – Android

Okay now that you have a clear idea of our project. Let’s get started.

First of all, create a project and add INTERNET permission in your project Manifest.XML file.

Go to your activity_main.xml and create three EditText fields and one Button.

This is a basic layout with no extra design. Just three EditTexts and a Button.

Now go to your MainActivity.java and paste the below code.

As you can see in the above code, there is not any validation. We have made this project as simple as possible. Though you should always do validation when creating this type of project. Validation like email validation or if a field is empty or not.

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *