Notify 1.4.2 always sends two emails
jolichter opened this issue · 9 comments
Hi Bob, maybe it is a bug? Notify always sends two emails instead of one.
I use
- MODX Revolution 2.7.1
- Notify 1.4.2
- Subscribe 1.2.2
- PHP 7.2.17
- PHPMailer 5.2.14
Also tested this with a new local installation and get the same two emails.
It can’t be the PHPMailer, because emails sends with FormIt only once?
PS: Sorry, I have started this issue in the modx forum, but I guess here it's better.
Here my Debug-Log:
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 347)
Total Count: 1
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 369) ************* NEW BATCH -- Batch 1
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 372) Clearing User Data
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 376) User Data Cleared
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 382) Doing Query
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 389) Query completed
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 394) Count: 1 -- Offset: 25
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 398)
1 Count: 1
Offset: 25
BatchSize: 25
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 417) Qualifying users
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 432) User qualified
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 439) Injecting Unsubscribe URL-- User: 1 -- Username: pms-test -- UnsubURL: https://testseite.de/abo/unsubscribe.html
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 448)
Unsub URL: https://testseite.de/abo/unsubscribe.html?ue=am9saWNAcG9zdGVvLmRl&uk=R7WXT0NDwqduIjr9qWnmGJz9vhR1kgpX-SXshCIUiCY
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 449) Unsubscribe injected -- User: 1 -- Username: pms-test
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 490)
pms-test -- testuser@gmx.de
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 497) All users added
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/model/modx/mail/modphpmailer.class.php : 175) You must provide an email address to send to.
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 510) Response code:
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 520) No Exception -- bad code -- Batch 1 -- Attempt: 1 -- Code:
[2019-04-29 01:05:51] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 528) Exception -- Batch 1 Retrying Attempt: 1
[2019-04-29 01:05:52] (ERROR @ /myserver..../modx/core/model/modx/mail/modphpmailer.class.php : 175) You must provide an email address to send to.
[2019-04-29 01:05:52] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 510) Response code:
[2019-04-29 01:05:52] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 520) No Exception -- bad code -- Batch 1 -- Attempt: 2 -- Code:
[2019-04-29 01:05:52] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 528) Exception -- Batch 1 Retrying Attempt: 2
[2019-04-29 01:05:53] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 540)
Full response:
1
[2019-04-29 01:05:53] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 546) End of batch error -- code:
[2019-04-29 01:05:56] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 660) Removing old files
[2019-04-29 01:05:56] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 675) Removing an old file
[2019-04-29 01:05:56] (ERROR @ /myserver..../modx/core/components/notify/processors/mgr/nfsendemail.class.php : 681) All old files removed
Are you telling Notify to send a "test email" or sending bulk email with just one user?
My wild guess is that PhpMailer is not reporting success even though the email has been sent successfully so Notify retries sending the batch. It might work properly if the batch has more than one user.
It could also be an issue with using a localhost install since the sending domain is not a real domain.
I use Mailgun (free) and haven't ever seen this issue there.
Hi, thanks for your statement.
Just tested it with 3 user and sending as bulk email and each user has received 2 emails again.
Tested on my localhost Linux computer and a real hosted domain. Strange!
btw: I don't like Mailgun, especially because of the German DSGVO (privacy policy).
I found an old thread on this at the MODX forums. Try this:
Edit the core/components/notify/processors/mgr/nfsendemail.class.php file and try changing line 503 from:
$maxAttempts = 3;
To
$maxAttempts = 1;
Thanks! This is a good workaround for me.
Unfortunately, this error log remains:
(ERROR @ /myserver..../modx/core/model/modx/mail/modphpmailer.class.php : 175) You must provide an email address to send to.
I excluded this log error in modphpmailer.class.php and I'm aware that this is a bad solution.
Do you have a &mailReplyTo value set in the properties?
Oops, yes that value was missing!
The error message "... email address to send to" is a little misleading. It should be better called "reply to"?
THANKS BOB!
It should, but it's a generic message in PhpMailer that fires when address() (used for "TO", "Reply To", CC and BCC) is called with an empty email address.
FWIW, the missing reply-to might have been the cause of your double messages.
Hi Bob,
Yesterday I go online with Notify and noticed that the emails still send two times (no error log).
However, this workaround from the old forum fix it:
$maxAttempts = 1;
Thanks. That fix will be in the next release.