Answers.Body: <p>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!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-20T20:52:49.010Z
Answers.LastActivityDate: 2016-10-20T20:52:49.010Z
Answers.UserDisplayName: AlainB
Answers.Body: <p>This may be because CiviMail is using a <a href="https://en.wikipedia.org/wiki/Variable_envelope_return_path" rel="nofollow noreferrer">VERP</a> format email as the from address, and it may be that G Suite does not permit this with your configuration.</p>
  
  <p>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.</p>
  
  <p>To disable VERP, navigate to Administer > CiviMail > Component Settings and disable 'Track replies using VERP in Reply-To header'.</p>
  
  <p>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.)</p>
  
  <p>See also <a href="https://civicrm.stackexchange.com/questions/2314/how-does-civimail-reply-tracking-and-forwarding-work">How does Civimail reply tracking and forwarding work?</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-20T20:53:27.757Z
Answers.Text: Thank you, Chris. Your answer made me find the cause of the error. (see below)
Answers.UserDisplayName: AlainB
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-20T09:30:09.613Z
Answers.LastActivityDate: 2016-10-20T09:30:09.613Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: Chris Burgess
Body: <p>On a 4.7.11 site, I'm trying to send mails using the smtp relay server of google.</p>
  
  <p>I followed the instructions on the google website for setting up mail relay in G suite (<a href="https://support.google.com/a/answer/176600?hl=en" rel="noreferrer">https://support.google.com/a/answer/176600?hl=en</a> and <a href="https://support.google.com/a/answer/2956491" rel="noreferrer">https://support.google.com/a/answer/2956491</a>)</p>
  
  <p>Then in CiviCRM I configured outbound mail settings like this:</p>
  
  <ul>
  <li>Select mailer: SMTP</li>
  <li>SMTP Server: smtp-relay.gmail.com</li>
  <li>SMTP port: 25</li>
  <li>Authentication? No</li>
  </ul>
  
  <p>When I click the "Save &amp; Send Test Email" button, it works. So the setup of google relay for my account is correct.</p>
  
  <p>Also, when I use activities to send an email, it works.</p>
  
  <p>But when I try to send a test email using CiviMail, I get the error:</p>
  
  <p>Error in call to Mailing_send_test : Failed to set sender: b.25.13.aa68527faac1fed1@EXAMPLE.ORG [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 [62.19.72.76]. 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)]</p>
  
  <p>Which is weird, because the IP address <em>is</em> correct and SMTP authentication is not required in my google settings.</p>
  
  <p>Is CiviMail using other settings than the one defined in the outbound mail settings screen? Or does it use another method to send mails?</p>
  
  <p>Thanks.</p>
  
  <p>Alain</p>
  
Tags: <civimail>
Title: Send test mail works, CiviMail doesn't
ThreadText: # Send test mail works, CiviMail doesn't
  
  (Asked by: username_0 on 2016-10-19)
  
  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: b.25.13.aa68527faac1fed1@EXAMPLE.ORG [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 [62.19.72.76]. 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?
  
  Thanks.
  
  Alain
  
  **Tags:** civimail
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-10-20. Score: 3
  
  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!
  
  
  ---
  
  ### Answer by username_1 on 2016-10-20. Score: 2
  
  This may be because CiviMail is using a [VERP](https://en.wikipedia.org/wiki/Variable_envelope_return_path) 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?](https://civicrm.stackexchange.com/questions/2314/how-does-civimail-reply-tracking-and-forwarding-work)
  
  > **Comments:**
  > **username_0**: Thank you, username_1. Your answer made me find the cause of the error. (see below)  
  
  ---
  
  