views.py
from django.core.mail import send_mail
def send(request):
subject = 'hi'
message = 'hello'
from_emaill = 'chidanandanayak06@gmail.com'
recipiant_list = ['chidanandanayak06@gmail.com','shuryansh.hot@gmail.com']
send_mail(subject,message,from_emaill,recipiant_list)
return render(request,'mail.html')
urls.py
path('mail/',views.send, name= 'sendmail')
我的服务器
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'chidananda'
EMAIL_HOST_PASSWORD = '**********'
EMAIL_POST = 587
EMAIL_USE_TLS = True
我不知道为什么异常断开连接!同样的事情也发生在另一个项目上。