emails from website getting rejected from email services

By wizzle - October 26, 2017

I sifted through the CMSB and plugin files to better understand you... and I can see where sendMessage is used in the forum plugin, in the website membership plugin, and on some core CMSB (like user password request).

I did find one instance of mail() being used in a plugin that I have called emailOnApproved. I don't see the plugin on the official Add-On's page so I think it's a small one that has been passed around the forums a bit.  I am actually using 3 instances of this plugin (renamed). 

So 2 questions...

1. even though the function being called is sendMessage, it is currently still using the built-in php mail() protocol because that's what I have selected in the email settings.  Have other people experienced a similar issue with using that protocol? Is switching to smtp generally a better choice anyways? Or does something just seem screwy with my particular web/email host?

2. Would I be safe in the emailOnApproved plugin to just change the line that says

mail($to,$subject,$message,$headers);

to simply

sendMessage($to,$subject,$message,$headers);

or are the parameters different?

Greg Williams

By wizzle - October 31, 2017

You have been fantastic Dave! Thanks for the help so far.

One hurdle that I can't figure out to get my email sending switched over to smtp. My web host has an hourly and daily smtp quota, as I'm sure all of them do.

I see a reference to "background send" in  outgoing mail (under email settings in CMSB), but I can't see how to configure it.

I thought perhaps this could be accomplished with the cron.php that you guys conveniently provided and the "background tasks" menu option, but I didn't see a way to implement delayed or background email sending.

While searching the forums, the only references I found to "background send" where in the newsletter plugin. Do I need to purchase the newsletter plugin to enable this feature? Or do I need to migrate my outgoing emails to a paid smtp service?

I also saw old threads that referenced mandrill (by mailchimp), but it no longer offers a free option.

Greg Williams

By Dave - October 31, 2017

Hi Wizzle, 

We're not currently using "Background Send", but it's available for plugins and other internal use.  We were going to use it with Newsletter Builder but having thousands of copies of emails in the outgoing mail queue wasn't as efficient as generating the email content on the fly when we were sending them.  So effectively you can ignore that option.

The first step is to find out what your hosts limits are. 

Next, if you're using newsletter builder you can configure the max send speed with these settings at the top of the plugin: 

$GLOBALS['BACKGROUND_SEND_MAX']     = 500; // max messages to send in each batch, eg: If a cronjob runs the script every minute and this is set to 30, you'll send approx 1800 emails an hour
$GLOBALS['BACKGROUND_SEND_WEB_MAX'] = 25;  // max messages to send when calling mailer through web interface, browser sessions can timeout so set this low (example: 25)
$GLOBALS['BACKGROUND_SEND_DELAY']   = 0;   // second to wait after sending each message

I'd just set them to slightly lower than the max.  Other than that, for regular email usage (forum alerts, password reset emails, etc) you should be fine.  But if you need to send a LOT of email very quickly then you'd either need to setup a cron as you suggest and throttle the emails to send slower and/or just find a 3rd party SMTP service and use them.

One issue with rate limited web hosts is that if you're sending a LOT of email and their limits are low it can take days just to send it all out.

Hope that helps!  

Dave Edis - Senior Developer
interactivetools.com