Send contact form data to e-mail address

I want to send submitted data from contact form to real email addresses which is defined before.

What is the proper and most simple way to do this?

Without using any 3rd party tool.

Also I don’t want to use AWS or similar service.

Is it possible doing this properly just using django.core.mail ?
https://docs.djangoproject.com/en/3.2/topics/email/

Thanks in advance.

As long as you have smtp-access to an email server, yes, that’s how it is done.

If you’re running a mail-transfer agent, such as sendmail or postfix, you can direct the email to your local service. If you’re not, then you will need to use some kind of external provider. If you don’t want to set up a separate account for this, you might be able to use your ISP’s mail service. Also, if the volume is small enough, Google makes gmail available.

To be clear, django.core.mail is not sufficient to send the email to the destination. It will send the email to a Mail Transfer Agent (MTA). It’s the MTA’s responsibility to route the mail to the destination.

Also, if you’re using a non-local SMTP service such as gmail, or if you’re sending the email out to multiple recipients, you probably don’t want to try sending the email in the view. This process is not instantaneous, and if there are any transient difficulties with actually sending the mail, you don’t want the person sending it having to wait for the mail to actually be sent before returning a response.

Also see - Whats the most suitable option for reliably sending small amount of email?.

1 Like