3

I am developing an android app where in an activity, I want to sent email.

Now the scenarios are: 1. The activity will send email only via the default gmail account of the android device. (No "Send via" picker will be shown) 2. the mail will automatically be sent without opening the gmail compose activity when I click on the SEND button of my Activity.

How can I do that ?

Additional question: is it possible to disable editing of send to, subject and email body of gmail from my app ?? if possible, then how ??

Khaled Saifullah
  • 2,279
  • 3
  • 25
  • 26
  • 3
    Full code is given [here](http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a) – krishna Oct 31 '13 at 07:50
  • Thank you all for your support. I have seen the links you have given, but the fact is that, it requires user to give his email address and password. What I want is to use the default email address of the device (hints: which is used for google play store). anyway, if that is not possible then what is about my additional question ?? – Khaled Saifullah Oct 31 '13 at 09:08

1 Answers1

0

follow the link that krishna suggested put your subject and body as a textview (not edittext)

and use in these lines:

GMailSender sender = new GMailSender("username@gmail.com", "password");
                sender.sendMail("My Subject That cannot be changed",   
                        "My Body That cannot be changed",   
                        "user@gmail.com",   
                        "user@yahoo.com");  

and follow all the steps suggested in this link: Sending Email in Android using JavaMail API without using the default/built-in app

Community
  • 1
  • 1
Chris Sim
  • 4,054
  • 4
  • 29
  • 36