emails from website getting rejected from email services

By wizzle - October 25, 2017

I've been having this problem since just after launching the website back in July (3 months) but have been too busy to really address it...

The website gwche.org is an organization of homeschool families in a local area.  Families join the organization through the website.  I am using the website membership plugin with CMSB to accomplish this. 

Aside from the nearly static information on the website, there are 2 basic features that are used...

1. A membership forum using the forums plugin.
2. The organization's board members can post events and announcements directly to the website (using CMSB). In addition to the new events and announcements posting to the website, an email with the new event or announcement is also sent out to the members.

Here's the issue I'm having...

There are several member's for whom the emails are getting rejected by their email service provider and bounced back to me as Undelivered Mail Returned to Sender.  The emails getting rejected are from forums and event/announcements.

I have verified that the email are actually being sent and that is the recipient email provider that is rejecting them. Unfortunately it doesn't seem to be a single email provider... I have rejected emails that are hotmail, aol, microsoft, yahoo, and I think Gmail.  But I have other users with those same email services who DO get the email.

The bounceback "undelivered Mail Returned to Sender" messages include something like

------------------------

<email address>: delivery temporarily suspended: host
    mailin-04.mx.aol.com[64.12.91.196] refused to talk to me: 421 4.7.1 :
    (DYN:T1) https://postmaster.aol.com/error-codes#421dynt1

Final-Recipient: rfc822; lisapem@aol.com
Original-Recipient: rfc822;lisapem@aol.com
Action: failed
Status: 4.7.1
Diagnostic-Code: X-Postfix; delivery temporarily suspended: host
    mailin-04.mx.aol.com[64.12.91.196] refused to talk to me: 421 4.7.1 :
    (DYN:T1) https://postmaster.aol.com/error-codes#421dynt1

----------------------------------------

There are about 150 members, and about 8-10 who's emails get returned to me as undelivered.

I have tried working with my hosting company but they seem sluggish on this issue.

It feels like the emails are getting tagged as spam or something and not being allowed to pass through, but I have no idea how to address that.

HELP. PRETTY PLEASE.

Greg Williams

By jenolan - October 25, 2017

I always use Sendgrid to actually handle sending, it is free for small sites so it is worth using. They do all the work adding the headers required to get past most SPAM/WhiteListing services.

Larry

---



Peace and Long Life

By Dave - October 25, 2017

Hi Larry, 

The linked AOL error indicates: 421 DYN:T1

  • The IP address you are sending from has been temporarily rate limited because it is not Whitelisted, unexpected increase in volume, or poor IP reputation.

How many @aol emails are on your list?  I found some info on AOL's rate limits here: http://www.yetesoft.com/free-email-marketing-resources/email-sending-limit/

It may be that your SMTP provider is sending more messages per connection than AOL allows, or that the sending server IP is blacklisted.  You could check here: https://mxtoolbox.com/blacklists.aspx

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By Dave - October 25, 2017

And by "Larry", I mean "Wizzle". lol :-)

Dave Edis - Senior Developer
interactivetools.com

By wizzle - October 25, 2017

UPDATE: I spent some time on live chat with my webhosting company. I have copied the relevant portion of our conversation below.

The bottom line is that he suggested I stop using the built in php mail() function and switch to using smtp for sending email from web forms and forum. It would involve installing PHPMailer or something similar.

Before I dive into that, does that seem like a reasonable solution?

---------------------------- Chat with Dreamhost ----------------------------------------------

(02:43:58)Ryan T: It's not something we can directly fix on our end.

(02:44:39)Greg: Is it the entirety of dreamhost mail servers have been placed on a block list?

02:46:31)Ryan T: They do get placed on blocklists from time to time, due to the servers being shared, and some customers abusing/misusing the services.

02:47:02)Greg: Do I need to move my email hosting or my entire website to a different host? It's been 3 months... I can't possibly continue with my members emails getting rejected so frequently

(02:47:44)Greg: Do you have any kind of recommendation?

(02:49:35)Ryan T: A dedicated mail host/option (Rather than a shared one) would be a better fit if you depend on your email service for user/business communication.

(02:50:09)Ryan T: As far as options? First of all, switching the site/script to use SMTP authentication vs direct mailing via PHP.

(02:50:35)Ryan T: SMTP/Mail provider wise, you can use just about anyone.

(02:51:05)Ryan T: We have some integration with Google Apps/Google Suite, but any custom MX records could work.

(02:52:24)Greg: So dreamhost does not have smtp authentication, but I could use googles?

(02:52:36)Ryan T: We do, actually.

(02:53:23)Ryan T: You can use our mail service. It's also a shared service, but on different servers than hosting. You said you were mailing directly from the servers, in this case.

02:54:12)Greg: well, I'm using the php mail() function... not sure if that is directly from the servers or the mail service

(02:55:33)Ryan T: php mail() is sent directly from the server, 'northumberland' in your case As far as Google goes, we have some options to set them up in the panel, but you can use anyone's mail servers if you have it set up.

(02:55:59)Greg: the address that is sending from is webmaster@gwche.org which is a fully configured email address hosted with dreamhost

(02:58:08)Ryan T: It's sending from php on the server, and spoofing a 'From' address to one fully hosted here, most likely:https://help.dreamhost.com/hc/en-us/articles/215507058-PHP-mail-overview

(02:58:20)Ryan T: You'd need to use PEAR for SMTP: https://help.dreamhost.com/hc/en-us/articles/216140597-How-do-I-send-PHP-mail-via-SMTP-

(03:00:19)Greg: I followed a link on that page that discusses PEAR... but also PHPMailer. I guess either of these 2 will allow sending email using smtp from the web form?

(03:01:36)Ryan T: Ah, forgot about that one. Both should work.

(03:02:31)Greg: looking at the phpmailer page on the dreamhost site, it has a grid discussing sending limits...

(03:02:48)Ryan T: That'd be the SMTP quota.

(03:03:04)Greg: could there be a sending limit that is causing my regular php mail() function to have problems?(03:03:37)Ryan T: php mailing has no limit, so they aren't related.

(03:04:12)Ryan T: Also, your errors would very clearly state that you've hit the SMTP limit. You're getting rejection messages from external servers, not our internal mail server.

(03:05:25)Greg: how confident are you that reconfiguring the code to use smtp instead of php mail() will allow all of the emails to get through?

(03:08:28)Ryan T: It may help, but it won't guarantee it. You may find that our mail servers are also being blocked by certain mail services for a similar reason. However, if that's the case, you have the option to switch your SMTP/Domain Mail provider to another service (let's say Google's, for the example?) You can then edit your script's authentication details to match the new Google address you made, and that should circumvent the server blocks entirely.

(03:09:58)Ryan T: Does that make sense? If it doesn't work on our servers, at least you have a straightforward next step for getting your email out.

(03:10:11)Greg: looking closer at that smtp quota grid, one of the lines says FTP & Shell users on shared servers. Sending using PHP/CGI scripts. 200 40 40MB (encoded)

(03:10:31)Greg: Is that still only being applied to smtp?

(03:11:42)Ryan T: That should still only apply to SMTP PHP/CGI scripts.

(03:12:44)Greg: so it looks like I need to pick either PEARL or PHPMailer, install, then edit the mail code to do smtp outgoing mail instead of the php function, correct?

(03:14:06)Ryan T: That would be my suggestion, yes.

Greg Williams

By wizzle - October 25, 2017

It also just dawned on me that cmsb already has the swiftmailer 3rdParty app included, which I believe is similar to the referenced phpMailer.  

Could I just modify the sending code to utilize swiftmailer instead of the built in php mail() function? 

If that's possible, it seems like that would have already been done in the forum plugin.  Am I missing something?

Greg Williams

By Dave - October 26, 2017

Hi Wizzle, 

Yes, for any CMSB code or plugins you can change how mail is sent under: 
Admin > Email Settings > How to send mail (and selecting SMTP)

However, if the issue is that your web host's mail server IP's are being blocked then you'll have the same issue and the solution would be to use a 3rd party mail sending service.  Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By wizzle - October 26, 2017

Thanks Dave.  I'll give it a shot.

One question.

I was under the impression that I would need to find all the instances where the php mail() function was used and somehow change it within the code to mail using smtp instead...

but it seems from your suggestion that I don't need to change anything in the actual cmsb or plugins files, and that I only need to change the "How to Send Mail" selection in the Admin>Email Settings.

Am I reading that right?  I should only change the settings but don't have to actually change the mail() function within the code itself? 

Greg Williams

By Dave - October 26, 2017

Hi Wizzle, 

Yes, that's right.  You only need to update mail() calls in custom code you may have created yourself.  For all our code we call our own function called sendMessage() that uses the CMSB mail settings, can log outgoing mail, etc. 

Dave Edis - Senior Developer
interactivetools.com