Enable emails in the CLI
You can change the email configuration for an active environment using the magento-cloud
CLI environment:info
command to set the enable_smtp
property. Enabling SMTP updates the MAGENTO_CLOUD_SMTP_HOST
environment variable with the IP address of the SMTP host for sending mail.
To manage email support from the command line:
-
On your local workstation, change to your project directory.
-
Check the outgoing email setting for the environment.
magento-cloud environment:info -e <environment-id> | grep enable_smtp
-
Change the email support configuration by setting the
enable_smtp
environment variable totrue
orfalse
.magento-cloud environment:info --refresh -e <environment-id> enable_smtp true
Wait for the environment to build and deploy.
-
Use an SSH to log into the remote environment.
-
Verify that the email works; send a test email to an address that you can check.
php -r 'mail("mail@example.com", "test message", "just testing", "From: tester@example.com");'
-
Verify that the email is picked up by SendGrid.
grep mail@example.com /var/log/mail.log