Setting up SMTP data for the contact form in Contao 4

This is an archive post. It will not be updated.

In Contao 4, you can add the SMTP data on the server in app/config/parameters.yml (up to Contao 4.7) or config/parameters.yml (from Contao 4.8) to the existing parameter values.

Important: In the parameters file, never use tabs (Tab key), only use spaces, otherwise errors will occur.

parameters
    … after installing Contao, the database access data is located here …
    mailer_transport: mail
    mailer_host: Hostname
    mailer_user: User
    mailer_password: Password
    mailer_port: 587
    mailer_encryption: tls

  • Hostname is the IP or address of the mail host.
  • User is the user name of the mailbox.
  • Password is the password of the mailbox.
  • The port is usually 587 or 465 (depending on the encryption set below). Your mail host can tell you which number is correct.
  • The encryption can be either ssl or tls. The port number changes accordingly.

Finally, you have to clear the application cache in the Contao Manager under Maintenance > Rebuild Production Cache.