As far as I read, Django only supports sending mails using SMTP.
据我所知,Django仅支持使用SMTP发送邮件。
I would like to send Emails from my script in Django, but do not want to setup SMTP server (it's too complex for me, I'm a linux newbie).
我想从Django的脚本发送电子邮件,但不想设置SMTP服务器(这对我来说太复杂了,我是一个linux新手)。
Is it possible, to send mails in Django in the same way like I do it in PHP, without providing SMTP login, password and etc?
是否有可能,像在PHP中一样在Django中发送邮件,而不提供SMTP登录,密码等?
5 个解决方案
#1
5
PHP uses sendmail on UNIX system to send emails. I guess at some point when you set up the system, this is, sendmail is configured.
PHP在UNIX系统上使用sendmail发送电子邮件。我想在你设置系统的某个时候,就是配置了sendmail。
There is an API to sendmail for Python, maybe it helps you. But there is a SMTP server involved in any case ;)
有一个sendmail for Python的API,也许它可以帮助你。但是在任何情况下都涉及到SMTP服务器;)
#2
3
Postfix and Exim were built to deal with all of the problems associated with forwarding email from your host to the rest of the world. Your app speaks SMTP to them, and they turn around and speak SMTP with the destination. But they're very, very good at it.
Postfix和Exim旨在解决与从主机向世界其他地方转发电子邮件相关的所有问题。您的应用向他们说SMTP,然后他们转身并与目的地说SMTP。但他们非常非常擅长。
There is nothing stopping you from doing a DNS lookup for the MX records of the email address you're sending to and connecting straight to that server and speaking SMTP to it. Nothing except that nagging voice that should be asking you "Is this really easier than apt-get install exim4?"
没有什么可以阻止您对要发送到的电子邮件地址的MX记录执行DNS查找,并直接连接到该服务器并向其发送SMTP。除了唠叨的声音之外什么都不应该问你“这真的比apt-get install exim4更容易吗?”
#3
2
So how does PHP do it? By magic?
那么PHP如何做呢?通过魔术?
If you don't have an SMTP server, sign up for a GMail account and use that.
如果您没有SMTP服务器,请注册GMail帐户并使用该帐户。
#4
2
Your hosting provider might have set up the host and any possible login credentials for all the PHP pages on their machines. This would make it seem like none are required. Your hosting provider should be more than happy to give you the information. Try searching for SMTP in their FAQ, forum, and any welcome emails they sent. If your search does not turn anything up, ask them directly.
您的托管服务提供商可能已为其计算机上的所有PHP页面设置了主机和任何可能的登录凭据。这样看起来似乎没有必要。您的托管服务提供商应该非常乐意为您提供相关信息。尝试在常见问题解答,论坛以及他们发送的任何欢迎电子邮件中搜索SMTP。如果您的搜索没有进行任何操作,请直接询问。
Once you have the information, you will want to add it to your settings.py file using these email settings:
获得信息后,您需要使用以下电子邮件设置将其添加到settings.py文件中:
# *** settings.py ***
#EMAIL_HOST = 'host here'
#EMAIL_PORT = 587
#EMAIL_HOST_USER = 'your user here'
#EMAIL_HOST_PASSWORD = 'your password'
#EMAIL_USE_TLS = True
Uncomment and use as many of these settings as you need.
根据需要取消注释并使用尽可能多的这些设置。
#5
0
I suppose since you're using Django you're fine with Python in general. There's a new Python MTA evolving which looks very promising http://lamsonproject.org/docs/hooking_into_django.html
我想,既然你正在使用Django,你通常可以使用Python。有一个新的Python MTA演变,看起来很有前途http://lamsonproject.org/docs/hooking_into_django.html
#1
5
PHP uses sendmail on UNIX system to send emails. I guess at some point when you set up the system, this is, sendmail is configured.
PHP在UNIX系统上使用sendmail发送电子邮件。我想在你设置系统的某个时候,就是配置了sendmail。
There is an API to sendmail for Python, maybe it helps you. But there is a SMTP server involved in any case ;)
有一个sendmail for Python的API,也许它可以帮助你。但是在任何情况下都涉及到SMTP服务器;)
#2
3
Postfix and Exim were built to deal with all of the problems associated with forwarding email from your host to the rest of the world. Your app speaks SMTP to them, and they turn around and speak SMTP with the destination. But they're very, very good at it.
Postfix和Exim旨在解决与从主机向世界其他地方转发电子邮件相关的所有问题。您的应用向他们说SMTP,然后他们转身并与目的地说SMTP。但他们非常非常擅长。
There is nothing stopping you from doing a DNS lookup for the MX records of the email address you're sending to and connecting straight to that server and speaking SMTP to it. Nothing except that nagging voice that should be asking you "Is this really easier than apt-get install exim4?"
没有什么可以阻止您对要发送到的电子邮件地址的MX记录执行DNS查找,并直接连接到该服务器并向其发送SMTP。除了唠叨的声音之外什么都不应该问你“这真的比apt-get install exim4更容易吗?”
#3
2
So how does PHP do it? By magic?
那么PHP如何做呢?通过魔术?
If you don't have an SMTP server, sign up for a GMail account and use that.
如果您没有SMTP服务器,请注册GMail帐户并使用该帐户。
#4
2
Your hosting provider might have set up the host and any possible login credentials for all the PHP pages on their machines. This would make it seem like none are required. Your hosting provider should be more than happy to give you the information. Try searching for SMTP in their FAQ, forum, and any welcome emails they sent. If your search does not turn anything up, ask them directly.
您的托管服务提供商可能已为其计算机上的所有PHP页面设置了主机和任何可能的登录凭据。这样看起来似乎没有必要。您的托管服务提供商应该非常乐意为您提供相关信息。尝试在常见问题解答,论坛以及他们发送的任何欢迎电子邮件中搜索SMTP。如果您的搜索没有进行任何操作,请直接询问。
Once you have the information, you will want to add it to your settings.py file using these email settings:
获得信息后,您需要使用以下电子邮件设置将其添加到settings.py文件中:
# *** settings.py ***
#EMAIL_HOST = 'host here'
#EMAIL_PORT = 587
#EMAIL_HOST_USER = 'your user here'
#EMAIL_HOST_PASSWORD = 'your password'
#EMAIL_USE_TLS = True
Uncomment and use as many of these settings as you need.
根据需要取消注释并使用尽可能多的这些设置。
#5
0
I suppose since you're using Django you're fine with Python in general. There's a new Python MTA evolving which looks very promising http://lamsonproject.org/docs/hooking_into_django.html
我想,既然你正在使用Django,你通常可以使用Python。有一个新的Python MTA演变,看起来很有前途http://lamsonproject.org/docs/hooking_into_django.html