3

I have a question regarding how to set up Craft 3 RC8 to send e-mails through a corporate GMail account.

  1. My website's MX records are pointed at GMail through Cloudflare
  2. I tried setting this up when my website was on Craft 2.6. I set that up and my e-mail got blocked. I unblocked it through GSuite admin account and switched back to php.
  3. When sending through PHP mail, my e-mails get sent into spam.

So I need help on whether how to get my e-mails sent through GMail without my account getting banned, or how to make the e-mails sent through PHP not go into spam.

2

I'm not sure how your email address got blocked, but Craft 3 uses the same SMTP smtp.gmail.com server and settings that Craft 2 uses when you choose to send email via "Gmail"

https://github.com/craftcms/cms/blob/develop/src/mail/transportadapters/Gmail.php#L91-L97

Sending email through PHPMail/sendmail is notoriously unreliable and I wouldn't recommend it on production.

https://craftcms.com/support/troubleshooting-email-errors#dealing-with-email-delivery-issues

And there are quite a few steps you can take to help ensure your email doesn't get treated as SPAM: https://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/

  • @Akbar 's email address was blocked by G Suite Gmail app because he used it to sign in to his Gmail account from Craft. Google evaluated the app as the app that doesn't meet their security standards. – Dominik Krulak Nov 19 '18 at 21:08
2

To use your G Suite Gmail (business Gmail) with Craft you need to do following.

  1. Admin Console > Security > Basic Settings > Go to settings to less secure apps

Once you are there, check "Enforce access to less secure apps for all users" option. It will allow you to log in on Non-Google apps, like a third party mail client or a web application.

  1. Admin Console > Apps > G Suite > Gmail > Advanced settings > Allow per-user outbound gateways

And check "Allow users to send mail through an external SMTP server when configuring a "from" address hosted outside your email domains".

Allow some time to propagate changes for the last step. To do those changes you must be "Super Admin" or "Admin" with required permission.

In Craft's control panel > Email > select SMTP protocol. Than follow this Google's answer.

To connect to Gmail server use settings from the "Step 2: Set up your mail client to access Gmail" > Other mail clients.

If you followed both steps from the Google's answer you should now be able to send a test email.

1

I had the same problems earlier. I now use Mailjet for SMTP purposes. They offer 6000 mails per month and all mails will be delivered. Also you can check per mail what happened?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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