问题
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 ??
回答1:
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
来源:https://stackoverflow.com/questions/19700728/sending-email-from-gmail-directly-in-android-from-my-app-without-opening-the-gma