emails from website getting rejected from email services

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

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
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 jenolan - October 25, 2017

Not me, I use SendGrid ... :-)

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life

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