简体   繁体   English

Python SMTPException,使用 Bottle-cork Bottle 插件

[英]Python SMTPException, using bottle-cork Bottle plugin

I'm creating a website.我正在创建一个网站。 Its backend is powered by Bottle framework.它的后端由 Bottle 框架提供支持。 I tried to use Bottle-Cork plugin, but got SMTPException error.我尝试使用 Bottle-Cork 插件,但出现SMTPException错误。

I run the sample code of Bottle-Cork source - simple_webapp.py with Python 2.我使用 Python 2 运行 Bottle-Cork 源代码的示例代码 - simple_webapp.py

I modified 21st line of the example file like this:我修改了示例文件的第 21 行,如下所示:

aaa = Cork('example_conf', email_sender='fsomeone@somewhere.com', smtp_url='smtp://username:password@192.168.3.2:25')

The error output is:错误输出是:

python simple_webapp.py 
Bottle v0.12.18 server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.

localhost - - [2019-12-30 23:43:48,401] Sending email using 192.168.3.2
127.0.0.1 - - [30/Dec/2019 23:43:48] "POST /register HTTP/1.1" 200 26
localhost - - [2019-12-30 23:43:48,424] Performing login
localhost - - [2019-12-30 23:43:48,426] Error sending email: SMTP AUTH extension not supported by server.
Traceback (most recent call last):
  File "/home/ggomee/.local/lib/python2.7/site-packages/cork/cork.py", line 968, in _send
    session.login(self._conf['user'], self._conf['pass'])
  File "/usr/lib/python2.7/smtplib.py", line 586, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.

On the server side, I installed Postfix server and the error output is:在服务器端,我安装了Postfix服务器,错误输出是:

Dec 30 23:43:48 arete postfix/smtpd[1284]: connect from unknown[192.168.3.26]
Dec 30 23:43:48 arete postfix/smtpd[1284]: lost connection after EHLO from unknown[192.168.3.26]
Dec 30 23:43:48 arete postfix/smtpd[1284]: disconnect from unknown[192.168.3.26] ehlo=1 commands=1

I found many similar questions here(StackOverflow), but they all answered to fix code manually.我在这里(StackOverflow)发现了很多类似的问题,但他们都回答手动修复代码。 According to them, should I fix Bottle-Cork plugin manually?根据他们的说法,我应该手动修复 Bottle-Cork 插件吗?

I think this error is caused by wrong setting of mail server.我认为这个错误是由邮件服务器设置错误引起的。 Anyway, help me, please.无论如何,请帮帮我。

I solved it.我解决了。 I skipped some Postfix setting steps.我跳过了一些 Postfix 设置步骤。

Following Postfix SMTP Auth doc step-by-step, I could finally send email to my account.遵循Postfix SMTP Auth doc一步一步,我终于可以向我的帐户发送电子邮件。 But as I'm new to SMTP and server configuration, I'm waiting more detailed answers and comments.但由于我是 SMTP 和服务器配置的新手,我正在等待更详细的答案和评论。

Of course it was treated as a spam mail by web mail clients.当然,它被网络邮件客户端视为垃圾邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM