I am trying to develop an app which has registration screen. I have used database for storing the data of users. On successful registration I want to send an email directly to the mail id of the user. How can I do that? I am new to android so please guide me.
-
what type of web services are you using ? – Ahmad Sanie Feb 14 '16 at 07:25
-
You can use resful api with type post and add params to body of post with key value pair combo – Usman Kurd Feb 14 '16 at 07:27
-
I have just created the form and I am trying to send the mail. I have not used any webservices. – Aniket Dhandhukia Feb 14 '16 at 07:28
2 Answers
You can setup your own mail server like postfix and sendmail, but you may face lots of difficulties using such a solution.
A better solution is using a third party solution like mandrill or mailchimp . they provide simple API to send email and have many nice features for tracking the mail and getting different types of reports.

- 639
- 7
- 16
so
how to send an email on successful registration
there are many hidden sides in your question as it depends on so many things for example are you using a local db ? if not what type of web services are you using? what is the SMTP server that you are going to use?
anyway i'll take all of the above in my considerations and i'll go through it step by step:
1-you have to setup your own mail (SMTP) server as mentioned above a good local SMTP server that can be used for testing is papercut check it out...
2-set up your own web service, lets assume that you'll be using php a function that will send a reg email will look like this:
if ($tag == 'successfullReg'){
$successfullReg = $_POST['successfullReg'];
$subject = "successfull Registration";
$message = "Hello User,you've registered successfully into *****.";
$from = "youreMail@Servername.com";
$headers = "From:" . $from;
$response["success"] = 1;
mail($forgotpassword,$subject,$message,$headers);
echo json_encode($response);
}
else {
$response["error"] = 1;
echo json_encode($response);
}
3- talk to the web service (JSON), and there are many good examples on this sub all around stackoverflow
if you were using a local db you can send an e-mail in android using your own SMTP.

- 1
- 1

- 3,678
- 2
- 21
- 56