Hommer Smith
Hommer Smith

Reputation: 27852

Rails: Sending email after sign up takes a while... What should I do?

I have a landing page where I let visitors to enter their email so that whenever we launch we can let them know. Right now, I am basically doing the following in my create action of my RegistrationsController.

UserSignUpMailer.welcome_email(resource).deliver

The problem here is that, since that deliver takes a while, the 'thank you' and other text that we show right after takes a while to show up.

I am wondering what are the possible solutions to this. I don't care if the email is sent right after 5 seconds or even 1 minute after, I prefer that the user doesn't wait for that text to show up.

Thanks

Upvotes: 1

Views: 45

Answers (1)

apneadiving
apneadiving

Reputation: 115531

Emails should be handled as background jobs.

Resque and Delayed Jobs are among the most popular.

Relevant Railscasts:

Upvotes: 5

Related Questions