<![CDATA[ Notify Extra sends email twice - My Forums]]> https://forums.modx.com/thread/?thread=104565 <![CDATA[Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562405
I'm using Notify to email updates to registered users. So far so good - it works well with one exception: it sends all the emails twice. 2 mails are better than none, but it's little annoying to the recipients.

Here some details about my environment and usage of Notify:

  • MODX: 2.6.5-pl
  • PHP: 7.2.10
  • PHPMailer: 5.2.14
  • Notify: notify-1.4.2-pl

On the Snippet of Notify I've added custom properties to use a group for all recipients which works fine at all.
modMailX is set as mailService.

The email is also sent twice if I choose a single email-address instead of the subscribers group on the Notify form.

Any ideas how to prevent this behavior?

Thanks!
Mike


]]>
flipflop1974 Oct 30, 2018, 06:56 AM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562405
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562850
There is also a mailgun-php package available via Composer that would probably be a better choice.

]]>
BobRay Nov 20, 2018, 09:47 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562850
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562849
Or is it more for mass emails to all users in a group?]]>
nuan88 Nov 20, 2018, 08:31 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562849
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562847
Another possible issue with Mailgun is that the SPF and DKIM records are not set up or incorrect. It took me a while to get them right.
]]>
BobRay Nov 20, 2018, 08:09 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562847
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562840
 $maxAttempts = 1;

Did the trick! Maaaaany thanks Bob!

Beside that, my PHP Version is 7.1.22 and all my credit card details are submitted to Mailgun.
Nevertheless, currently I am very happy with this solution, so I will probably continue the mailgun setup later.

By the way, thank you for your help here in the forum all the time. I've had some problems with MODX before, and you answer almost every question. That said: Thanks again for your time, patience and effort!
Just wanted to say that.]]>
flipflop1974 Nov 20, 2018, 08:25 AM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562840
<![CDATA[Re: Notify Extra sends email twice (Best Answer)]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562836
I may also have discovered why modMailX is sending duplicates. If you want to go back to it, you can edit the core/components/notify/processors/mgr/nfsendemail.class.php file and try changing line 503 from:

$maxAttempts = 3;

To
 $maxAttempts = 1;


Though I should mention that in addition to the deliverability issues, modMailX is very slow because it doesn't allow true templating variables so it requires that each email be sent individually.
]]>
BobRay Nov 19, 2018, 09:46 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562836
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562736 https://bobsguides.com/notify-tutorial.html (toward the end of the article).

Mailgun now requires that you give them a credit card, so if you haven't, that could be the issue. I receive "bills" from them, but the charge is always $0.

]]>
BobRay Nov 14, 2018, 09:34 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562736
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562717 Quote from: BobRay at Nov 10, 2018, 05:53 PM
Notify will use Mailgun out of the box. You could look at the Notify code if you want to implement it in other places. I've never done it. Look at the MailgunX class in the Notify files under core/components/notify.

Hi Bruno,

I've set up Mailgun right now. I configured it in the Notify Props:
mailService => MailgunX
mailgun.domain => my freshly created and by Mailgun verified subdomain 
mailgun_api_key => the key provided by Mailgun


When trying to send an email now, I get "Results: E-mail to subscribers sent successfully to 1 recipients using MailgunX"
But no Email was sent at all.

So I turned on the dubug mode
mailgun.debug => Yes


And that's the content of the log (I just replaced some sensitive data with asterisks) after trying to send 1 Email:

[2018-11-14 15:57:30] (ERROR @ /var/www/vhosts/*****/httpdocs/core/components/notify/model/notify/mailgunx.class.php : 96) 
 **********  MailgunX class **********

[2018-11-14 15:57:30] (ERROR @ /var/www/vhosts/*****/httpdocs/core/components/notify/model/notify/mailgunx.class.php : 231) 

Prepared Tpl
TEST CONTENT
[2018-11-14 15:57:30] (ERROR @ /var/www/vhosts/*****/httpdocs/core/components/notify/model/notify/mailgunx.class.php : 262) 

Final Fields
Array
(
    [from] => ***** ***** <**@*****.**>
    [subject] => *******
    [text] => TEST CONTENT
    [html] => TEST CONTENT
    [h:Reply-To] => 
    [to] => ******.*****@*****.**
    [recipient-variables] => []
)

[2018-11-14 15:57:31] (ERROR @ /var/www/vhosts/*****/httpdocs/core/components/notify/model/notify/mailgunx.class.php : 262) 

Final Fields
Array
(
    [from] => ***** ***** <**@*****.**>
    [subject] => *******
    [text] => TEST CONTENT
    [html] => TEST CONTENT
    [h:Reply-To] => 
    [to] => ******.*****@*****.**
    [recipient-variables] => []
)




I can't manage to get the exact cause of the errors. Do you?
The line number references in the ERROR log (eg 231 or 262) just brought me to the line where Notify writes the error to the log but not (as I assumed) to the line of code where the error is thrown.

So I got stuck right now... Any ideas are highly welcome ;-)

]]>
flipflop1974 Nov 14, 2018, 03:07 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562717
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562645
Look at the MailgunX class in the Notify files under core/components/notify.]]>
BobRay Nov 10, 2018, 05:53 PM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562645
<![CDATA[Re: Notify Extra sends email twice]]> https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562641 Quote from: flipflop1974 at Nov 10, 2018, 09:57 AM
Thanks BobRay, I had a look at Mailgun and will give it a try. Silly question, do you have some hints or examples how to implement the Mailgun service in MODX?

This looks useful, its new, is it only for cloud installations though, I am not sure

https://support.modx.com/hc/en-us/articles/216947987-Configure-MODX-to-Use-an-Email-Service-Provider]]>
nuan88 Nov 10, 2018, 11:12 AM https://forums.modx.com/thread/104565/notify-extra-sends-email-twice?page=2#dis-post-562641