srja4
srja4

Reputation: 13

how send email from android application directly?

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.

I Know javamail but need email .. other user can decompiler app and theft email :)

Upvotes: 1

Views: 4807

Answers (2)

Fahim Al Mahmud Ashik
Fahim Al Mahmud Ashik

Reputation: 1121

There are two ways to send email from android application directly without any intent

  1. using SMTP & JavaMail API 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 because it's simpler than first approach.

** Edit: You can save email in sharedpreferences or database and fetch it from there when you try to send mail rather than hardcoding it to avoid theft email risk.(directly putting mail address inside code)

Anyway you can prevent other from getting your full source code.See this answer

Upvotes: -1

fjc
fjc

Reputation: 5805

The way to go is to send the mail via some server, not directly from the device. You would, for example, connect to a REST API that sends out the email for you. Sending an email directly from the device from the user's email address is not (and should not be) possible

Upvotes: 2

Related Questions