Aniket Dhandhukia
Aniket Dhandhukia

Reputation: 11

Sending email on successful registration

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.

Upvotes: 1

Views: 1169

Answers (2)

Ahmad Al-Sanie
Ahmad Al-Sanie

Reputation: 3785

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 = "[email protected]";
          $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

And here is a good link that might help you to build a Complete Android Log-in Registration System with PHP, MySQL.

if you were using a local db you can send an e-mail in android using your own SMTP.

Upvotes: 0

ayyoob imani
ayyoob imani

Reputation: 639

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.

Upvotes: 1

Related Questions