23

I am building a form that sends emails from an android application, I am using Intents to send the email, that is:

Intent sendIntent;
sendIntent = new Intent(Intent.ACTION_SEND);

My requirement is that I want the email to be sent immediately, currently the application is showing me installed email applications in device where I can recompose the email before sending, I want to send the mail directly without showing installed applications.

Thanks

Johann Blais
  • 9,389
  • 6
  • 45
  • 65
Hassan Mokdad
  • 5,832
  • 18
  • 55
  • 90
  • Checkout https://gist.github.com/gelldur/9c199654c91b13478979 – Gelldur May 27 '15 at 10:44
  • See these solutions: [solution 1](http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android-app/2033124#2033124) [solution 2](http://stackoverflow.com/questions/2197741/how-to-send-email-from-my-android-application) and [email with attachments](http://stackoverflow.com/questions/3585556/how-to-send-email-in-android) – Muhammad Zeeshan Jun 07 '11 at 11:50
  • Solution 1 is good but there are two issues: How can I get the email and password saved on the echange server of my device, and second thing does it work for both secure and insecure mail servers? and what if I need to add attachments – Hassan Mokdad Jun 07 '11 at 11:53
  • if you check more answers in solution 1, you will find out the attachment code. – Muhammad Zeeshan Jun 07 '11 at 12:01
  • i have updated the answer for attachments. – Muhammad Zeeshan Jun 07 '11 at 12:04
  • thank u !! answer 1 was very helpful thank u :) but don't forget to add internet permission and to tick all the added libraries in Order and Export – Chris Sim Oct 18 '13 at 13:54
  • Thanks a lot, I was able to get the owner email account, but not the password, I kept getting the error: "Caller uid 10085 is different than the authenticator's uid",Regards – Hassan Mokdad Jun 07 '11 at 13:53
  • Try this also, http://stackoverflow.com/questions/2556495/get-owners-email-address – Muhammad Zeeshan Jun 07 '11 at 13:07
  • use this http://developer.android.com/reference/android/accounts/AccountManager.html – Muhammad Zeeshan Jun 07 '11 at 13:02
  • No, when you configure your device for sending mails, you actually give it a user name and password which the device saves and uses for future email sending and synchronizing, my question is how to get these saved values? – Hassan Mokdad Jun 07 '11 at 12:50
  • Do you mean email address of any contact? – Muhammad Zeeshan Jun 07 '11 at 12:45
  • It is working great, but any idea about the exchange server email and password saved on the device? Thanks again – Hassan Mokdad Jun 07 '11 at 12:37
  • Thanks Mohammad, it worked fine, I didn't test the attachment code though, One more thing, how can I get the email and password saved on the exchange server of the device, is this possible? – Hassan Mokdad Jun 07 '11 at 12:27
  • I don't want static password.. i want dynamic data as the user has signed in to the device...how can I implement solution 1 with this requirement... as username and password can vary from device to device – SweetWisher ツ Apr 21 '14 at 09:14

3 Answers3

2

There are two ways

1) using SMTP follow the link for details

2) using Webservice( for example PHP script ) so there is a server side code and you hit that URL with param like ( name,subject etc) so basically PHP code send mail at the end and it's very easy to use .

Personally, I suggest you use Webservice

Mayank Sharma
  • 2,735
  • 21
  • 26
0

From what I have been able to find people suggest you write your own mini email app within your app. The following link is to a person who did just that:

http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_(no_Intents)_in_Android

Keep in mind to scroll through the bottom comments when you get stuck implementing certain parts. I hope that helps you from reinventing the wheel. :)

Tyrant911
  • 321
  • 1
  • 2
  • 7
0

There are two solution

1) use JavaMail API

2) Implement SMTP to send mail without showing default.email application.

Revansiddappa
  • 708
  • 1
  • 7
  • 16