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:

  1. On your local workstation, change to your project directory.

  2. Check the outgoing email setting for the environment.

    magento-cloud environment:info -e <environment-id> | grep enable_smtp
    
  3. Change the email support configuration by setting the enable_smtp environment variable to true or false.

    magento-cloud environment:info --refresh -e <environment-id> enable_smtp true
    

    Wait for the environment to build and deploy.

  4. Use an SSH to log into the remote environment.

  5. 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");'
    
  6. Verify that the email is picked up by SendGrid.

    grep mail@example.com /var/log/mail.log
    
Previous pageActivity stream
Next pageSendGrid email service

Commerce