我可以将sendmail用于Django的send_mail吗? [英] Can I use sendmail for Django's send_mail?

查看:74
本文介绍了我可以将sendmail用于Django的send_mail吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在VPS上建立一个基于Django的爱好站点,我对Django的电子邮件系统配置感到困惑.我的服务器正在使用sendmail成功向我发送技术电子邮件(例如,来自fail2ban).但是,所有与Django相关的谷歌搜索都提到后缀,例如在其他答案中.

I am setting up a Django-based hobby site on a VPS, and I am confused with Django's email system configuration. My server is successfully sending me technical emails (e.g. from fail2ban) using sendmail. However all Django-related googling mentions postfix, e.g. in this other answer.

我想知道:

  • 如果我可以使用sendmail而不是postfix;
  • 如何配置Django以使用服务器的邮件功能.

非常感谢您的帮助.

FWIW,我使用的是Ubuntu 16.04和Django 1.10.

FWIW, I am on Ubuntu 16.04 and Django 1.10.

推荐答案

默认情况下,Django似乎不提供在本地使用sendmail的后端.

It seems Django does not offer a backend for using sendmail locally by default.

我可以看到两个选项:

  1. 使用SMTP后端并将smtp主机使用"localhost"(这实际上是默认值).仅当您的邮件服务器配置为接受SMTP连接并允许中继来自本地主机的连接时,此方法才有效.
  2. 使用第三方后端,该后端调用 sendmail 命令.快速搜索出现 https://github.com/perenecabuto/django-sendmail-backend似乎应该可以工作.
  1. Use the SMTP backend and use "localhost" for the smtp host (this is actually the default). This only works if your mailserver is configured to accept SMTP connections, and allows relaying for connections from localhost.
  2. Use a third-party backend that calls the sendmail command. A quick search turns up https://github.com/perenecabuto/django-sendmail-backend which seems like it should work.

这篇关于我可以将sendmail用于Django的send_mail吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆