我有一个 Web 应用程序,我希望能够在需要时向任何用户发送自动电子邮件。我正在对其进行测试,一切似乎都很好,但我注意到收件人电子邮件没有收到任何消息。下面是我在settings.py文件中的配置。
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'beaubien.web-dns1.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'med.abdillah@massiwatechnology.com'
EMAIL_HOST_PASSWORD = '###########'
EMAIL_USE_SSL = True
EMAIL_USE_TLS = False
这是views.py文件。
def send_email(request):
send_mail('Bonjour cher personnel',
'Hello there,Ceci est un message automatique.',
'med.abdillah@massiwatechnology.com',
['abdillah@buaa.edu.cn'],
fail_silently=False,
)
return render(request, 'courriers/send_email.html')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sent!</title>
</head>
<body>
<h1>Send an email!</h1>
</body>
</html>
请帮助我。提前谢谢你