Cron issues sending mail with CMSB 3.50 or earlier, and PHP 7.2 after a Bluehost server upgrade (Solved)
1 posts by 1 authors in: Forums > CMS Builder
Last Post: April 10, 2019 (RSS)
By gkornbluth - April 10, 2019 - edited: April 10, 2019
About a month ago, I moved an account to a new server at Bluehost, and I started having major problems with sending emails using a cron job.
After weeks of playing around, many days waiting for Bluehost's senior level support, and hours of Daniel Loewe and Dave Edis' time, The issue of why emails were never received when using a mailarray or an email template, is solved. (The problem didn't affect phpmail)
Bluehost narrowed it down to Message-ID issues similar to: <65812fc901465e02d09689bdaf6a902f@swift.generated>.
Seems, according to Dave Edis, the senior guru at Interactive Tools, (as well as I understand it) if there's no $_SERVER['SERVER_NAME'] set. See: https://forge.typo3.org/issues/24686, a header is generated by the swift mail program.
Daniel worked up a fix, and at least part of it will be rolled out in a future version of CMSB
Here's the fix that Daniel created.
1) Add your domain name to the end of your cron job (after a space, and no http or www)
2) Add the following code to the top of the cron.php file (above "//load viewer library" code) (i put mine after the load viewer library code by mistake and it still worked)
3) Add the same code to any page that addresses CMSB's sendMessage() function from outside the background task framework (like mailarray or email template triggering scripts)
if (empty($_SERVER['HTTP_HOST']) && isset( $_SERVER['argv'][1])) {
$_SERVER['SERVER_NAME'] = $_SERVER['argv'][1]; // set server name for SwiftMailer Message-ID in cron tasks (https://forge.typo3.org/issues/24686)
}
Daniel said, "The extra code should only be necessary when using CMSB's sendMessage() function. it's worth noting that this fix will be in cron.php in a future CMSB version (either 3.51 or 3.52), so after that, it will only be applicable for users setting up cron jobs that use sendMessage() outside of CMSB's background tasks or users on older versions."
Hope this save someone a bit of aggravation....
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php