Configure Sylius Mailer To Work With Zoho Mail SMTP

Afrimadoni Dinata
2 min readSep 20, 2018

I’ve just installed Sylius eCommerce framework recently and feeling great with it because it’s very easy to customize although there are still many part of the documentation that need to be improved 😉 . I was happy until I get stuck with email sending for days, below is my first app/config/parameters.yml file:

...
mailer_transport: '%env(SYLIUS_MAILER_TRANSPORT)%'
mailer_host: '%env(SYLIUS_MAILER_HOST)%'
mailer_user: '%env(SYLIUS_MAILER_USER)%'
mailer_password: '%env(SYLIUS_MAILER_PASSWORD)%'
mailer_port: '%env(SYLIUS_MAILER_PORT)%'
mailer_encryption: '%env(SYLIUS_MAILER_ENCRYPTION)%'
...
env(SYLIUS_MAILER_TRANSPORT): smtp
env(SYLIUS_MAILER_HOST): smtp.zoho.com
env(SYLIUS_MAILER_USER): my_zoho_email_address
env(SYLIUS_MAILER_PASSWORD): my_zoho_password
env(SYLIUS_MAILER_PORT): 465
env(SYLIUS_MAILER_ENCRYPTION): ssl
...

At first glance there seem nothing is wrong with my parameters.yml file, I’ve follow what zoho says about their SMTP settings but still I’m unable to send email and got this error:

request.CRITICAL: Uncaught PHP Exception Swift_TransportException: "Connection could not be established with host smtp.zoho.com [Connection timed out #110]" at /project_path/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php line 269

Then I opened this article: how to send email with Symfony and realized that I haven’t set proper configuration yet 😅, so I need to change my app/config/config.yml as follow:

swiftmailer: 
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
port: '%mailer_port%'
encryption: '%mailer_encryption%'
auth_mode: '%mailer_authmode%'
spool: { type: memory }

again, I’m still unable to send email but now with different error message:

request.CRITICAL: Uncaught PHP Exception Swift_TransportException: "Expected response code 250 but got code "553", with message "553 Relaying disallowed as "Example.com" <no-reply@example.com> "" at /project_path/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php line 419

And finally to fix this issue, I must override sylius mailer configuration in /project_path/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/sylius/sylius_mailer.yml, add these line into app/config/config.yml:

sylius_mailer:
sender:
name: 'noreply@yourdomain.com'
address: '%mailer_user%'

--

--