Django contact form sending email

后端 未结 1 1475
Happy的楠姐
Happy的楠姐 2020-12-22 08:02

I created a contact form to send me an email when the user fills it out. Everything appears to be working, but I\'m not getting an email.

Here\'s my console output:<

1条回答
  •  一向
    一向 (楼主)
    2020-12-22 08:29

    The console backend, as the name suggests, prints out the email to the console and doesn't do anything else.

    You need to use a different email backend, for example the smtp backend is the default:

    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    

    You'll then have to configure your settings like EMAIL_HOST with your email provider's settings. See the docs for more info.

    If you don't want to use the SMTP backend, another common choice is to use a transactional mail provider like Mailgun or SendGrid. Some of these services have free usage tiers which should be sufficient for a low-volume contact form. The django-anymail app supports several transactional mail providers.

    0 讨论(0)
提交回复
热议问题