To use JavaMail API for sending mails in Android without using the default built-in App

0 votes

I am trying to send mail through application in Android .

By using this:

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

will solve my work. But, I want to send my mails by single button click.

Jun 6, 2018 in Java by prasad
• 160 points

1 answer to this question.

0 votes

ADD 3 jars found in the following link to your Android Project


And don't forget to add this line in your manifest:

<uses-permission android:name="android.permission.INTERNET" />

Check with the sample project:

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MailSenderActivity extends Activity {

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

        final Button send = (Button) this.findViewById(;
        send.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub

                try {   
                    GMailSender sender = new GMailSender("", "password");
                    sender.sendMail("This is Subject",   
                            "This is Body",   
                } catch (Exception e) {   
                    Log.e("SendMail", e.getMessage(), e);   


answered Jun 6, 2018 by sridhar
• 160 points

Related Questions In Java

0 votes
1 answer

Sending Email in Android using JavaMail API without using the default/built-in app

Send e-mail in Android using the JavaMail ...READ MORE

answered Dec 4, 2018 in Java by Daisy
• 8,110 points
0 votes
1 answer

How to call a method after a delay in Android using Java?

final Handler handler = new Handler(); handler.postDelayed(new Runnable() ...READ MORE

answered Jun 11, 2018 in Java by Akrati
• 3,170 points
+1 vote
1 answer

How to tell the Maven to use the latest version of dependency in Java?

If you always want to use the ...READ MORE

answered Jun 26, 2018 in Java by Sushmita
• 6,900 points
0 votes
1 answer

What are the Foreign key constraints in Android using SQLite

You can use, Foreign key constraints with ...READ MORE

answered Aug 24, 2018 in Java by geek.erkami
• 2,680 points
+2 votes
1 answer

How do I ask the Selenium-WebDriver to wait for few seconds in Java?

There are two ways to wait: explicit ...READ MORE

answered Dec 19, 2018 in Java by Daisy
• 8,110 points

edited Dec 19, 2018 by Daisy 209 views
0 votes
1 answer

How to specify the certificate to use for authenticating the server to client?

You can try the command given below. System.setProperty(" ...READ MORE

answered Jan 2, 2019 in Java by Daisy
• 8,110 points
+2 votes
1 answer

please someone tell the code to launch an instance in digital ocean using java

In order to create a digital ocean ...READ MORE

answered Jan 14, 2020 in Java by Sirajul
• 59,070 points
0 votes
1 answer

how to read csv file form sftp connection and store into string object in java code and convert into it using rest api

Hey, @Pooja, Before starting with anything you should ...READ MORE

answered May 13, 2020 in Java by Roshni
• 10,480 points