我得到"服务器不支持SMTP AUTH扩展"发送具有不同域名的邮件时 例如,我已使用person@example.com发送邮件。我的域名是example.com。
当我尝试发送邮件时,我得到了"服务器不支持SMTP AUTH扩展"错误
settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.somedomain.com'
EMAIL_HOST_USER = 'Admin@somedomain.com'
EMAIL_HOST_PASSWORD = '***********'
EMAIL_PORT = 25
EMAIL_USE_TLS = True
views.py
msg = "Hi,this is testing mail."
try:
send_mail('Appointment mail',msg,'',['user@somedomain.com'])
response = 'Message sent successfully.You will receive response in very soon.Thank you.'
except Exception as e:
response = e
return HttpResponse(response)
任何人都可以帮助我,提前致谢!
答案 0 :(得分:2)
我认为这可以帮到你。 Getting 'str' object has no attribute 'get' in Django。你无法返回' str'直接作为回应。你需要HttpResponse
from django.http import HttpResponse
return HttpResponse(response)
希望这有帮助。