We have a web site that requires users to signup and they then receive an activation email
Our current method of doing this is including the whole email process within the registration thread itself i.e.
Register() {
registerUser()
sendActivationMail()
return View(Successpage)
}
Where sendActivationMail then contains all the necessary code to connect to our mail server and send the email etc. We know this isn't the best way to do it, rather we just did this quickly to test everything out. The problem is obvious, the user ends up waiting longer for the "thank you for signing up page" as the page is only returned after everything else has finished.
The options to this properly that we're aware of are:
- Start a new thread to send out the email once the database side of the registration is complete and return the original thread immediately.
- Persist the email to the database and have a thread that runs contiounously and checks the database for new emails to send every x minutes
- Use a third party email service such as Amazon Simple Email Service.
Are there any other methods to use? Do any of the above stand out as the best?
Thanks in advance for any help.