user1452936
user1452936

Reputation: 575

python django send_mail does not work since smtp servers not supported

I first tried to use django send_mail function in my python code.

But my live servers does not support SMTP and hence i was asked to try using qmail-inject or mail which are unix commands.

Has anyone does this before ? how can we set the subject, recipient etc from python code and send a email using qmail-inject or mail which are unix commands?

Upvotes: 1

Views: 281

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174662

You need to create a custom email backend that does the sending for you. You can customize this snippet, which uses sendmail and replace that with the appropriate command for your scenario.

Once you have your custom backend, set EMAIL_BACKEND in settings.py to point to the Python module path not the filesystem path.

Upvotes: 1

Related Questions