Duplicate Comfirmation Emails being sent from Appointments+ since 1.8.2

Prior to the release of 1.8.2, here's how the confirmation emails worked when a new appointment was created...

One email sent to client.
One email sent to the service provider and admin (meaning the service provider and admin were both listed on the 'to' line of the the same email)
One custom email sent (I did an add_filter( 'app_confirmation_message'...) in the functions.php file because I needed to send a differently formatted email to a special email address for each new appointment).

Beginning with the release of 1.8.2 here's how the confirmation emails work when a new appointment was created...

One email sent to client.
One email sent to the service provider
One email sent to the admin
- note, the service provider and admin are no longer both on the 'to' line of the same email.They each get a separate email.
Three custom emails.
- One custom email is sent after each of the emails above is sent.

To me it appears that...
+ Before 1.8.2, the routine to build the email would get called once and then used for each email address.
- Beginning with 1.8.2, the routine to build the email appears to be getting called multiple times.

I need this fixed because having that custom email be sent off three times is wreaking havoc in my system.

And i repeat - it worked fine before 1.8.2 came out and I made no changes to the code so I'm confident that 1.8.2 is the culprit.

Kind Regards,

Chris

  • Rupok

    Hi Chris, hope you had a wonderful day.

    Okay. I understand your situation. Obviously getting same email three times is not a good user experience. But can you give us little more info? When does it repeat? Does your server send three times at the same time or at a certain interval? Can you provide the URL of your site where I can create an appointment and see the issue live?

    Can you try installing version 1.8.1 and check if your issue is gone again? Unfortunately I'm not getting emails 3 times for the same appointment. So might be version 1.8.2 is conflicting with something else on your site? We will be glad to investigate further if any conflict is found. Can you do a plugin conflict test just to make sure no other plugin is causing this? To know more about plugin conflict test, you can check this article: http://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    Please note, you said you changed nothing in your site. So it's not like some of your other plugins have gone crazy, but they might be conflicting specifically with Appointments+ version 1.8.2 .

    I just found your another thread which is I believe regarding the same issue. And I see Nithin could not regenerate this either.

    As it's pretty tough for a doctor so give proper medicine without seeing the patient, it's kinda same. It's really tough to provide a working fix without checking full configuration and details. However, as it's beyond the policy of your company to provide access, can you create a staging site with dummy data but with same configuration where we can check the issue live, try to fix it, and when we are done, you apply the patch in your live site. As you said "I tested it on an almost new system and still had the issue", I believe the same issue will be there in your staging site.

    Please let us know if you have any better suggestion. I'm looking forward to hear from you and resolve this issue as soon as possible.

    And to track the issue better, can you please close one thread from these two, so we all can focus on one thread and get all updates at the same place?

    Have a nice day. Cheers!
    Rupok

  • Chris

    1.8.1 does not fix the issue.

    You can duplicate the issue on your server...

    1. Enable the following add-ons
    Allow HTML emails
    Locations
    Service Locations
    Worker Locations
    Default Service
    Durations
    Shared Resources
    2. Setup a service provider with one email address that is not the admin email address for the site.
    3. Setup a location and assign it to the service.
    4. Make sure 'send confirmation' is set to 'yes'.
    5. Create an appointment
    make sure that the email address is not either the admin or service provider email address
    select the service provider
    save the appointment.

    You will get three, separate emails.

    One will come to the admin.
    One will come to the service provider.
    One will come to the client.

    Previously, only two emails would have been generated.
    One that would go to both the admin and service provider (in other words, one email with both the admin and service provider on the 'to' line)
    One email to the client.

    So - this is a definite difference.

    Here's where it gets worse in my system.

    I need to send out another, customized email when the confirmation gets sent.
    To do this, I put this code in my functions.php file...

    add_filter( 'app_confirmation_message', 'trigger_some_update', 10, 3);
    function trigger_some_update( $msg, $obj, $app_id ) {
    wp_mail( 'replace with an email address' , 'New Appointment', 'Some Text');
    return $msg;
    }

    Note: It's not code I'm using in my main system. I cut the main code down to what I pasted above and used it for testing and it gave the same results.

    So...

    1. Paste the code I put above into your functions.php file.
    2. Enter an email address that isn't the admin, service provider or client in the 'replace with an email address'.
    3. Go to the appointment you created above.
    4. Resend the confirmation.

    Here's what you will get...
    Email #1 - Confirmation to Client
    Email #2 - Custom email generated by the code in part 2
    Email #3 - Confirmation to Service Provider
    Email #4 - Custom email generated by the code in part 2
    Email #5 - Confirmation to Admin
    Email #6 - Custom email generated by the code in part 2

    Here's what used to happen...
    Email #1 - Confirmation to Client
    Email #2 - Conformation to Admin and Service Provider
    Email #3 - Custom email generated by the code in part 2

    This all changed when I installed 1.8.2

    On more thing to note...

    I checked and I went right from version 1.6 to 1.8.2 so I have no way of knowing which version the error started in.

  • Kasia Swiderska

    Hello Chris,

    You will get three, separate emails.

    One will come to the admin.
    One will come to the service provider.
    One will come to the client.

    This correct - from version 1.6 plugin some parts of Appointments were rewritten and now it sends separate email to admin and service provider. This is not bug.

    I need to send out another, customized email when the confirmation gets sent.
    To do this, I put this code in my functions.php file...

    add_filter( 'app_confirmation_message', 'trigger_some_update', 10, 3);
    function trigger_some_update( $msg, $obj, $app_id ) {
    wp_mail( 'replace with an email address' , 'New Appointment', 'Some Text');
    return $msg;
    }

    I've tested this code and indeed it is sending emails three times - for each of the emails that are send.
    I asked developer if there is action that is triggered only once so addition email is send only once - he is not currently online, but when I will get answer from him I will update this thread.

    kind regards,
    Kasia

  • Kasia Swiderska

    Hello Chris,

    I spoke with developer and he prepared this code:

    add_filter( 'appointments_send_confirmation', 'trigger_some_update', 10, 2 );
    function trigger_some_update( $send_confirmation, $app_id ) {
        if ( $send_confirmation ) {
            wp_mail( 'your email' , 'New Appointment - custom email', 'Some Text');
        }
    
        return $send_confirmation;
    }

    I've tested it on my site and it sends only one email, please try it and let me know if this is also working on your site.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.