Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.8k views
in Q2A Core by

Found this error in my error logs: 

PHP Question2Answer email send error: You must provide at least one recipient email address.

It derives from the class.phpmailer.php: 

if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
          throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
}

It happened when I did a mass-mailing from the admin panel. 

But checking my users, there are none that have empty email addresses. What could be the reason?

1 Answer

+2 votes
by
selected by
 
Best answer
That doesn't mean there is an empty email address but rather the recipient arrays are empty. When filling those with actual email addresses the PHPMailer class performs some filters on its own. Maybe there is an email address that Q2A filters assumed to be valid (that's why it is actually present) but the PHPMailer filters rejected it, so it didn't get to the recipient arrays.

If that assumption is correct, then I guess Q2A should use PHPMailer's filters when validating email addresses.
by
+1
Finally could find one of those email addresses that causes the error: m.b.st.y.fr.ero.@gmail.com - some letters changed due to privacy, but I reckon it's the dot before the @ sign that causes problems with PHPMailer.
by
These changes should fix it. Give it a try: https://github.com/q2a/question2answer/pull/773

PS: It won't fix already existent email addresses but it will prevent new ones from registering
by
Those emails are by PHP really invalid: filter_var($email, FILTER_VALIDATE_EMAIL) throws false.

Thanks for the fix!
...