Configure Shopware Mailer

The following article explains how to customize the Mailer settings in Shopware 6 via the graphical administration or via SSH to configure a local email service, SMTP server or environment configuration.

Log in to the Shopware Administration. You can access Shopware Administration via your primary store URL including the path /admin.

Example:

https://<your-shop-domain.com>/admin#/login/


Then navigate to Settings → System → Mailer to configure the settings.



Local e-mail service (Sendmail)

For the Preferred e-mail agent setting, select the Local e-mail agent setting.

With this setting, outgoing e-mails are sent directly via the Linux binary /usr/bin/sendmail. For all creoline Shopware Server outgoing emails are sent directly via the connected Postfix mail server.



SMTP server

For the Preferred e-mail agent setting, select the SMTP server setting.


You can then enter the access and connection information for the external SMTP server in the following area.


Enter the access data for your SMTP server and then click on Save for the changes to take effect.


To test the settings, you can temporarily enter an e-mail address under Recipient address to send all outgoing e-mails to this address.



Environment configuration

For the Preferred e-mail agent setting, select the Use environment configuration setting.



Extend environment configuration

Connect to your Shopware server via SSH, for example, to adjust the mailer settings via the .env.local configuration file and then use the mailer of the Symfony framework.


Add the following configuration to the .env.local:

###> symfony/mailer ###
MAILER_DSN=smtp://<SMTP username>:<SMTP password>@<SMTP server>:<port>
###< symfony/mailer ###


Then clear the cache of your Shopware installation so that the changes take effect. To do this, change to the directory of your Shopware installation and execute the following command:

bin/console cache:clear


Execute the cache:clear command with the SSH user who is also the owner of the files to avoid subsequent authorization errors when recreating the Shopware cache.