We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Forms, Members

Emails being sent from Perch appearing with an error in Gmail

Whenever I receive or a user of my website receives an email notification sent via Perch (Forms/Members) then Gmail displays it with the following caution:

View Screenshot

Any ideas how I can stop this form happening? Some website users are also informing me that Perch notification emails are appearing in SPAM. I'm assuming this is related?

Richy Thomas

Richy Thomas 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How do you have things configured?

I posted a few weeks back as the system wasn't sending any email notifications at all. You advised me to speak to my hosting provider which I did and they provided me with the following information.

define('PERCH_EMAIL_METHOD', 'smtp');
define('PERCH_EMAIL_HOST', '10.168.1.70');
define('PERCH_EMAIL_AUTH', false);
define('PERCH_EMAIL_SECURE', 'no');
define('PERCH_EMAIL_PORT', 25);
define('PERCH_EMAIL_FROM', 'admin@mydomain.com');
define('PERCH_EMAIL_FROM_NAME', 'My Company');
Duncan Revell

Duncan Revell 78 points
Registered Developer

Have you ever heard of SPF records?

You need to add a TXT record for your domain name that includes the external name of the mail server your host has given you. The SPF basically says "the mail for your domain has been sent from this mail server - please accept it."

I have yes. Was just unsure what TXT record to add.

So because I'm using Gmail - Is this the Record I need to add?

v=spf1 include:_spf.google.com ~all

Got the information from here

Duncan Revell

Duncan Revell 78 points
Registered Developer

Yup, that's the correct format.

However, just to be clear - you are sending mail from Gmail? Does that mean your website is hosted with Google too? Your EMAIL_HOST IP address is an internal address, so I imagine mail is passed from your (Google) web server to a Gmail server?

Are you sending email from your server with an email address that's hosted by Google? If so, your SPF record might need to look more like:

"v=spf1 +a +mx +ip4:10.168.1.70 include:_spf.google.com ~all"

So my site is hosted on Vidahost and those guys provided me with the following information to add to my config file in order for the notifications to work at all:

define('PERCH_EMAIL_METHOD', 'smtp');
define('PERCH_EMAIL_HOST', '10.168.1.70');
define('PERCH_EMAIL_AUTH', false);
define('PERCH_EMAIL_SECURE', 'no');
define('PERCH_EMAIL_PORT', 25);
define('PERCH_EMAIL_FROM', 'admin@mydomain.com');
define('PERCH_EMAIL_FROM_NAME', 'My Company');

My domain is managed via Route53 and there I have MX records that point to Gmail.

I'm guessing the SPF record I mentioned will do the trick.

Ok thanks - I'll try that

To test, you can send a notification email to yourself, then in Gmail, click the 'more' dropdown at the top right of the message and select 'Show original.' This will tell you whether the SPF is pass, neutral or fail.

Duncan Revell

Duncan Revell 78 points
Registered Developer

I wouldn't add a 10.x.x.x IP address to an SPF record - it's a private address range, so won't be public facing.

That must be sending mail to an internal Vidahost mail server, which then sends it externally. Not sure how it can be sent by Gmail, unless Vidahost somehow relay to Gmail.

Duncan Revell

Duncan Revell 78 points
Registered Developer

I just noticed this:

My domain is managed via Route53 and there I have MX records that point to Gmail.

I'm guessing those notification emails from Perch are being sent via Vidahost mail servers, not Gmail. The MX records are there to direct mail that is coming into your domain.

You therefore need to find out the external address for mail that is sent from Vidahost.

This doesn't seem to have worked.

I think you're right Duncan.

Vidahost provided me those details to add to my perch config file to allow PHP emails to be sent through the server i'm guessing. So now my users are receiving the email but the SPF is failing.

Email says that the email is coming from:

AMSO Online admin@amso.onlineUsing PHPMailer 5.2.14 (https://github.com/PHPMailer/PHPMailer)

So is it my Vidahost Server I need to add a SPF record for as apposed to Gmail.

Gmail is what is sued to manage the admin@amso.online account so I assumed I would need to verify Gmail??

Doh, I copy/pasted the IP without even noticing it's a 10.x.x.x. I agree with Duncan, need to find the external IP of the Vidahost mail server and add that to SPF. If you check the email headers for the notification email ("show original" in Gmail), it should tell you the reason SPF is failing and possibly show the IP of the mail server that isn't authorized.

It says:

SOFTFAIL with IP 91.208.99.71

So Do I need to add a TXT record of "91.208.99.71" ?

Use the SPF record I mentioned but replace the 10.x.x.x IP with 91.208.99.71

Just reading Vidahost docs and they say to add either

"v=spf1 include:gridhost.co.uk ~all" "v=spf1 a mx ip4:91.208.99.71~all"

I've done this and i'm still getting a FAIL.

Do these perhaps take a while to update?

Duncan Revell

Duncan Revell 78 points
Registered Developer

Again, I probably wouldn't want to use an IP address in an SPF record (unless I could help it) - Vidahost may use a cluster of mail servers. When you send a mail, any of the servers in the cluster could send the message, with a different IP address. If you can find a generic hostname for the mail cluster, that would be better.

Or, set the SMTP settings to the Gmail SMTP settings - or did you have that before? To confuse matters, some hosts stop the use of third-party SMTP servers (although most allow port 465 or 587 to connect to third-party SMTP servers).

Duncan Revell

Duncan Revell 78 points
Registered Developer

You posted whilst I was typing. Use the gridhost one - and yes, it's a DNS change, so can sometimes take a while. The mail server receiving the email has to be able to see the SPF record on your domain - it may take some time to filter through to that mail server.