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,050 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,150 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,880 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,320 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,050 points

edited Dec 19, 2018 by Daisy 62 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 in Java by Daisy
• 8,050 points
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,190 points
0 votes
1 answer

How to print java array in the simplest way?

String[] arr = new String[] {"John", "Mary", ...READ MORE

answered Apr 17, 2018 in Java by sophia
• 1,400 points
0 votes
2 answers

What is the use of toString method in Java and how can I use it ?

Whenever you require to explore the constructor ...READ MORE

answered Aug 23, 2018 in Java by Daisy
• 8,050 points