More than 1 year has passed since last update.

アドオン追加

heroku addons:add sendgrid

SMTPの設定

if HEROKU:
    EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
    EMAIL_HOST = 'smtp.sendgrid.net'
    EMAIL_PORT = 587
    EMAIL_USE_TLS = True
    EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD']

実際に送る

from django.core.mail import send_mail


send_mail(
    u'Title!',
    u'Content',
    'Ottatiyarou <info@otatin.com>',
    [送信先アドレス, ],
    fail_silently=True,
)

٩(๑❛ᴗ❛๑)۶