我是Bluehost和Django的新手,我正在尝试使用Django在我的Bluehost服务器上设置“通过电子邮件重置密码”功能。我在设置主机和端口号时尝试了不同的组合,但由于某种原因它从未起作用。所以这就是我所拥有的:(我目前只在我的本地计算机上工作。)
在我可以配置我的电子邮件帐户的Bluehost网站上,它列出了:
手动设置
在settings.py中,我将电子邮件配置为:(我将列出两个组合和相应的错误消息)
组合1
DEFAULT_FROM_EMAIL = 'admin@my_host.com'
SERVER_EMAIL = 'admin@my_host.com'
EMAIL_USE_TLS = False
EMAIL_HOST = 'box664.bluehost.com'
EMAIL_HOST_PASSWORD = 'my_email_password'
EMAIL_HOST_USER = 'admin+my_host.com'
EMAIL_PORT = 465
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
错误消息:异常值:连接意外关闭
组合2
DEFAULT_FROM_EMAIL = 'admin@my_host.com'
SERVER_EMAIL = 'admin@my_host.com'
EMAIL_USE_TLS = True
EMAIL_HOST = 'mail.my_host.com'
EMAIL_HOST_PASSWORD = 'my_email_password'
EMAIL_HOST_USER = 'admin+my_host.com'
EMAIL_PORT = 26
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
错误消息:异常值:(535,“身份验证数据不正确”)
有人能给我一些我做错的建议吗?任何帮助表示赞赏。
答案 0 :(得分:3)
以下设置:
CGPoint p1 = CGPointMake(100, 100);
CGPoint p2 = CGPointMake(200, 200);
CGPoint p3 = CGPointMake(300, 300);
//Animate box
[UIView animateWithDuration:0.7 animations:^{
CGRect oldFrame = boxView.frame;
boxView.frame = CGRectMake(p1.x, p1.y, oldFrame.size.width, oldFrame.size.height);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.7 animations:^{
CGRect oldFrame = boxView.frame;
boxView.frame = CGRectMake(p2.x, p2.y, oldFrame.size.width, oldFrame.size.height);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.7 animations:^{
CGRect oldFrame = boxView.frame;
boxView.frame = CGRectMake(p3.x, p3.y, oldFrame.size.width, oldFrame.size.height);
} completion:^(BOOL finished) {
}];
}];
}];
为我工作。我测试的django版本是1.8.8。 解释了Bluehost smtp设置详细信息here。
答案 1 :(得分:1)
我完全不知道问题是什么,但我遇到了同样的问题。我认为这与SMTP / SSL有关。所以我用过这个:https://github.com/perenecabuto/django-sendmail-backend
然后我在settings.py中使用了这个配置:
EMAIL_USE_SSL = False
EMAIL_USE_TLS= False
EMAIL_HOST = 'box###.bluehost.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'someone@example.com'
EMAIL_HOST_PASSWORD = 'password'
希望它有所帮助。