By Dave - October 26, 2017

Hi Wizzle, 

To answer your 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?

CMSB can send mail a variety of ways, but yes the default still calls mail() (through swift mailer).  mail() is just a PHP function that hands off the message to the outgoing mail server that's running on the server.  It does pretty much the same thing as logging in via SMTP but faster.  

It's likely that switching to SMTP won't change anything, but systematically following the advice of your web host is a good way to rule out issues and get further support.  And if in the end, they don't have a reliable outgoing mail server, you'll still use SMTP but just be specifying another provider.

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

The parameters are different.  Most of our internal functions have short instructions or examples in the code above where they're defined.  See if you can find sendMessage (search for: function sendMessage) and figure it out.  If you need help let me know!  Post back and let me know how it goes.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

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.

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