Async Tasks for Django and Gunicorn

I have a use case where I have to send_email to user in my views. Now the user who submitted the form will not receive an HTTP response until the email has been sent . I do not want to make the user wait on the send_mail. So i want to send the mail asynchronously without caring of the email error. I am using using celery for sending mail async but i have read that it may be a overkill for simpler tasks like this. How can i achieve the above task without using celery

Answers


I'm assuming you don't want to wait because you are using an external service (outside of your control) for sending email. If that's the case then setup a local SMTP server as a relay. Many services such as Amazon SES, SendGrid, Mandrill/Mailchimp have directions on how to do it. The application will only have to wait on the delivery to localhost (which should be fast and is within your control). The final delivery will be forwarded on asynchronously to the request/response. STMP servers are already built to handle delivery failures with retries which is what you might gain by moving to Celery.


Need Your Help

Can I credit an Apple user's account?

iphone in-app-purchase

When my app takes an in-app purchase, is it possible for the app to transfer some of the payment to another Apple user's account?

Curl returns empty string

php curl

I have rather strange issue. I have an access to site(email and password). Sorry, but I can not show this site to you. I need to get some info from it's content.