There is a trouble with email sending in Modx Revolution. Using FormIt plugin, I tried to enable Gmail SMTP at Modx settings list, but the same result. Now SMTP is disabled.
Using this FormIt call:
[[!FormIt?
&hooks=`email,redirect`
&redirectTo=`19`
&redirectParams=`{"success":"1"}`
&emailTpl=`feedbackEmailTpl`
&emailSubject=`New request from [[++site_name]]`
&emailTo=`***@gmail.com`
&emailToName=`Support`
&emailReplyTo=`***@gmail.com`
&emailFrom=`***@gmail.com`
&emailFromName=`***@gmail.com`
&errTpl=`<span class="label label-warning">[[+error]]</span>`
&validate=`
name:required:stripTags,
clientemail:email:required,
message:required:stripTags
`
&clearFieldsOnSuccess=`1`
&validationErrorMessage=`Error.`
]]
In error.log file:
[2015-06-02 10:33:37] (ERROR @ /var/www/site/core/model/modx/mail/phpmailer/class.phpmailer.php : 893) PHP warning: preg_match(): Compilation failed: internal error: previously-checked referenced subpattern not found at offset 728
[2015-06-02 10:33:37] (ERROR @ /var/www/site/core/model/modx/mail/phpmailer/class.phpmailer.php : 893) PHP warning: preg_match(): Compilation failed: internal error: previously-checked referenced subpattern not found at offset 728
[2015-06-02 10:33:37] (ERROR @ /index.php) [FormIt] Произошла ошибка при попытке отправить почту. Пожалуйста, введите хотя бы один адрес e-mail получателя.
What can be wrong? Is this trouble bound to PHPMailer?
This is a PHP bug that affects PHP 5.5.25 and 5.6.9 when run using mod_php with apache. There are a few workarounds until it's fixed in PHP.
This last method would be done like this:
class myMailer extends PHPMailer
{
public static function validateAddress($address, $patternselect = 'php')
{
return parent::validateAddress($address, $patternselect);
}
}
Then use that subclass instead of the plain PHPMailer class. The same bug has been affecting various other PHP projects such as Typo3 and SwiftMailer. The bug to track it in PHPMailer is here.