On a 4.7.11 site, I'm trying to send mails using the smtp relay server of google.

I followed the instructions on the google website for setting up mail relay in G suite (https://support.google.com/a/answer/176600?hl=en and https://support.google.com/a/answer/2956491)

Then in CiviCRM I configured outbound mail settings like this:

  • Select mailer: SMTP
  • SMTP Server: smtp-relay.gmail.com
  • SMTP port: 25
  • Authentication? No

When I click the "Save & Send Test Email" button, it works. So the setup of google relay for my account is correct.

Also, when I use activities to send an email, it works.

But when I try to send a test email using CiviMail, I get the error:

Error in call to Mailing_send_test : Failed to set sender: [email protected] [SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP). (code: 550, response: 5.7.0 Mail relay denied []. Invalid credentials for relay for one 5.7.0 of the domains in: example.org (as obtained from helo and mail-from). 5.7.0 Email is being sent from a domain or IP address which isn't registered 5.7.0 in Google Apps account. Please login to your Google Apps account and 5.7.0 verify that your sending device IP address has been registered within 5.7.0 Google Apps SMTP Relay Settings. For more information, please visit 5.7.0 support.google.com/a/answer/6140680#maildenied e9sm8480344wjh.2 - gsmtp)]

Which is weird, because the IP address is correct and SMTP authentication is not required in my google settings.

Is CiviMail using other settings than the one defined in the outbound mail settings screen? Or does it use another method to send mails?



2 Answers 2


Apparently, CiviCRM adds a lot of things before the @yourdomain.com in the From-address. Things like a job id, event queue id, and a hash. Google didn't like that because that email address didn't match an existing mailbox. Luckily, in the Google SMTP relay settings, you can specify to accept any address from your domain. That did it!


This may be because CiviMail is using a VERP format email as the from address, and it may be that G Suite does not permit this with your configuration.

Conversely, when sending a single test email, CiviCRM will be using the default site email address OR the email of your CMS user's CiviCRM contact. This works because G Suite sees a known, working email from your domain, and permits delivery.

To disable VERP, navigate to Administer > CiviMail > Component Settings and disable 'Track replies using VERP in Reply-To header'.

VERP is a good thing for accurate bounce / unsubscribe handling, so I don't recommend disabling it. Instead I'd recommend looking to get G Suite configured to support it better, or using an outbound mail provider which supports either VERP or other reliable means of handling bounces / unsubscribes / etc. (There are various extensions for providers which do something similar, but that's a whole other topic.)

See also How does Civimail reply tracking and forwarding work?

  • Thank you, Chris. Your answer made me find the cause of the error. (see below)
    – AlainB
    Commented Oct 20, 2016 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.