Phoca email failure

Phoca Email (Newsletter) - sending emails and managing newsletters in Joomla! CMS
guildofen
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Feb 2022, 21:16

Phoca email failure

Post by guildofen »

Hi
I am getting this an error when sending email bcc to a group with 385 people in it. This used to work. Two things that I know of have changed - I updated from J3.10.4 and am now on J3.10.6 - the contents of the group will have changed, but I can't say exactly by how much.

The mail is not sent and there is no error message from the email server - there is a failure message from Joomla saying that the email has not been sent.

I can bcc smaller groups and it works fine. I can also use Joomla's mass mail to write a mail and bcc the group with 385 people in and there is no problem.

I am running out of ideas, I have tried the database query (in adminstrator/components/com_phocaemail/helpers/phocaemailsend.php) that builds the bcc list and it returns something sensible.

What am I missing?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca email failure

Post by Jan »

Hi, can you paste a screenshot of the error here?

When you enable debug mode, do you get some more information or error? When you enable PHP logging of errors on the server, do you get some errors there :idea:

Jan
If you find Phoca extensions useful, please support the project
guildofen
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Feb 2022, 21:16

Re: Phoca email failure

Post by guildofen »

Hi Jan
Sorry for the slow reply - I have been trying to get a bit more information before coming back.
First - I am using version 3.1.3 of the component.
You should be able to see the failure in this image: https://imgur.com/a/HtQWFLa

There was not any additional information from debug or logging.

I put my own logging either side of the sendMail() call in administrator/components/com_phocaemail/helpers/phocaemailsend.php and dumped out the bcc list just before the call. The bcc list (from a Joomla group) has 377 entries and looks fine (no odd characters). Exactly the same test works perfectly with a smaller bcc list. The sendMail() function returns false, but with no error message.

I also looked at the code in adminstrator/components/com_users/models/mail.php. Sending to the same group using this code works - but they have used the Send() function, not sendMail().

Finally - my hosting provider ran strace while I tested but can see nothing in the logs.

This all (I think) looks like I am hitting a limit in sendMail(). The PHP version on the server is 7.3.31 and they can't update at the moment.
My probably next plan might be to rewrite phocalemailsend() to use Send() - not quite sure how to do this yet. If you have any better suggestions please let me know!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca email failure

Post by Jan »

Hi, based on the error, it seems like this is much more an external problem where you don't get any answer from the server but only the info, that the email was not sent (it seems like some limitation without setting any error message :idea: )

Jan
If you find Phoca extensions useful, please support the project
guildofen
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Feb 2022, 21:16

Re: Phoca email failure

Post by guildofen »

Hi
Yes, that was why I asked the hosting company to look at the server logs and trace the activity when I sent the mail. However - there is nothing in their logs and there was nothing shown in strace.
I think this, and the fact that sending the same email to the same group using Joomla's mass mail, means that it is something between Phoca Email, Joomla and PHP.
As I said - I'll try re-writing the the bit that sends mail to use Send() and see if that works. I'll let you know if it makes a difference.
guildofen
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Feb 2022, 21:16

Re: Phoca email failure

Post by guildofen »

Hmm - well.

This is simpler than I thought - but I also still don't understand it.

I set up and ran another set of tests trying to vary the from and to addresses. As far as I can tell the cause of the failure is having the 'to' address also present in the 'bcc' group.

Does that make any sense to you?
guildofen
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Feb 2022, 21:16

Re: Phoca email failure

Post by guildofen »

Here is the explanation.

If an email address is duplicated in any of the recipients eg 'to', 'cc', 'bcc' etc then libraries/vendor/phpmailer/phpmailer/class.phpmailer.php will return false from addOrEnqueAnAddress().

This is reasonable because it doesn't make sense to send the same email twice to the same person. The class libraries/src/Mail/Mail.php will return false in sendMail() after the call to addBcc() - this calls add() then eventually results in a call to the parent class (PHPMailer) and to addOrEnqueAnAddress().

In my case I was bcc-ing a group and had not realised that my 'to' address was also listed in that group. What might be helpful is if the phocaemailsend() method caught the false and gave an indication of what the issue *might* be. Rather than just returning false with no error message?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca email failure

Post by Jan »

Hi, thank you for the info. Maybe better solution will be comparing email addresses in to, cc and bcc togehter

For now, email addresses are checked only in each part for duplicity:

Code: Select all

if (!empty($cc) && is_array($cc)) {
   $cc = array_unique($cc);
}
Mostly when method returns false, it can even send the message information to system, which should be then displayed in adminstration. I will take a look at it.

Thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
guildofen
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 05 Feb 2022, 21:16

Re: Phoca email failure

Post by guildofen »

Hi - yes, that would better I think. Adjusting the error message was just what I thought would be a minimum effort solution. Thanks for looking into a proper fix.
Zoe
Post Reply