我正在尝试使用我的 gmail smtp 和金字塔邮件程序包从我的金字塔网站发送电子邮件。首先,如果有人对电子邮件解决方案有其他建议,请告诉我!
我将以下内容添加到我的 dev.ini 中:
mail.host = smtp.gmail.com
mail.username = user@gmail.com
mail.password = password
mail.port = 465
mail.ssl = True
Run Code Online (Sandbox Code Playgroud)
然后我像这样发送消息:
config.registry['mailer'] = Mailer.from_settings(settings)
Run Code Online (Sandbox Code Playgroud)
然后...
mailer = request.registry['mailer']
message = Message(subject="hello world",
sender="admin@mysite.com",
recipients=["someaddress@gmail.com"],
body="hello!")
mailer.send(message)
Run Code Online (Sandbox Code Playgroud)
不幸的是,我得到以下异常:
SMTPServerDisconnected: please run connect() first
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
谢谢!
我有一个带有企业数据库的python应用程序,我希望能够按名称搜索企业(用于自动完成目的).
例如,考虑名称"最佳购买","麦当劳","索尼"和"苹果".
我希望"app"返回"apple",以及"appel"和"ple"."麦当劳"应该回归"麦当劳"."bst b"和"best-buy"都应该返回"最佳购买".
我在寻找哪种算法,是否有python实现?
谢谢!