所以我在views.py
中有这样的代码pip install -e ~/Repositories/some_local_fork_repo_path/
我想添加标题'List-Unsubscribe',但它不起作用,我收到服务器错误。如果我使用'#'代码,代码工作正常。如何添加此标题?感谢。
答案 0 :(得分:4)
您可以尝试使用EmailMessage
from django.core.mail import EmailMessage
email = EmailMessage(
'subject',
'message.',
'info@xyz1234.de',
to=['MYTEST@yandex.ru'],
headers={'MY-UNIQUE-HEAD': '<http://www.xyz1234.de/unsubscribe123'},
)
email.send(fail_silently=False)
设置
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'YOURUSER@gmail.com'
EMAIL_HOST_PASSWORD = 'YOURPASS'