Answers
- 在MailGun注册;
- 按提示配置DNS信息(有点多);
- 登录后,在mailgun的控制台页面(https://mailgun.com/cp),点击你的域名,查看邮件的登录信息;
打开django的settings.py进行配置。如下:
EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.mailgun.org' EMAIL_HOST_USER = '[email protected]' EMAIL_HOST_PASSWORD = 'SOMEPASSWORD' EMAIL_PORT = 587
测试
./manage.py shell >>> from django.core.mail import send_mail >>> send_mail('MailGun works great!', 'It really really does.', '[email protected]', ['[email protected]'], fail_silently=False)
精肛互撸娃
answered 10 years, 5 months ago
也可以使用 django-mailgun, https://github.com/bradwhittington/dj...
安装django-mailgun
pip install django-mailgun
将下列配置添加到settings.py中
EMAIL_BACKEND = 'django_mailgun.MailgunBackend' MAILGUN_ACCESS_KEY = 'ACCESS-KEY' MAILGUN_SERVER_NAME = 'SERVER-NAME'
高达不萝莉
answered 10 years, 5 months ago