Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: Multiple Duplicate Notification Emails
Status | Resolved |
Add-on / Version | Publisher Lite 2.8.2 |
Severity | |
EE Version | 4.2.3 |
James Carter
Jun 19, 2018
Description:
Client receives multiple emails of the same notification whenever they make changes.
Detailed steps to reproduce the issue:
1. Client makes publishing request.
2. Client receives multiple of the same notification emails.
BoldMinded (Brian)
Those aren’t steps to reproduce. What is the view status? What is the save status? Is it a request for approval? What is the contents of the email? E.g is it a approval request or a normal EE entry save notification? Does this happen to all users or just 1?
BoldMinded (Brian)
What environment does this happen in? Have your tried other envrionments? What steps have you taken to debug it? Have you altered any settings to try to figure out the cause?
BoldMinded (Brian)
James, sorry for all the questions, but I do need a little more to go on for this one. I haven’t seem similar reports, so it may just be a configuration issue, or a legit bug if the stars have aligned on several different criteria. The more information you can provide the quicker we can get to the bottom of the issue.
Megan Miriello
It’s perfectly fine. I will get more information from the client and get back to you.
Megan Miriello
Sorry for the delay, the client was on vacation. Everyone is receiving two notifications each time there is a request for approval. This is a live environment. I was able to replicate the issue with selecting myself in the Approval Email List. I tried deselecting everyone, clear the cache, then reselect the appropriate accounts with no success. Here is the duplicate email: Training Account (email) has submitted the entry “Test Page” for Publishing on 06/26/2018 02:00pm. Edit Entry View Entry.
The status is still in draft and it’s in the top of list for Pending Approvals.
BoldMinded (Brian)
So you’re the only one in the approval list, and you’re the one saving the entry for approval? Or is someone else saving the entry?
Megan Miriello
I’m using a publisher account to to save the entry and clicking the checkbox for “Send for Approval?” I’m not the only one on the approval list since this is a live site. For testing purposes, I have my Super Admin on the Approval email list to see if I receive duplicate emails, in which I do.
BoldMinded (Brian)
James, I’m feeling like this is something with your settings because I just tested locally and it is only sending 1 approval email (from Publisher) and 1 entry updated email (native EE behavior) if EE is configured to do so. My Mailgun log shows only 1 of each sent. Are you positive you don’t have both setup with the same subject and body text? Or some other odd configuration? Have you tried setting up EE and Publisher in a new/clean environment (potentially on a different server) to see if you can replicate duplicate email sending?
Mailgun log:
https://screenshots.firefox.com/CIQy6iLEk9ci6Dlj/app.mailgun.com
Megan Miriello
I’m searching through the backend and I’m still not finding the duplicated subject and body input inside any settings. Could you look through the backend for me? I feel like I’m missing something. I was going to upload credentials, however, the Edit Ticket button is missing for some reason.
Megan Miriello
I have edited the ticket with the login information. Thanks!
BoldMinded (Brian)
I just logged in, but its not an admin account. I can’t see EE’s native email/notification settings.
BoldMinded (Brian)
And I can’t see Publisher’s settings either.
Megan Miriello
Ok, just upgraded you to Super Admin. Let me know if that works for you.
BoldMinded (Brian)
I didn’t see anything out of the ordinary. Looks like all the native channel entry notification settings are disabled. Have you tried to replicate this in a new/clean environment? Have you been able to check with the server email logs or whatever service you may be using to send emails to see if its getting 1 or 2 of the same requests to send an email?
Megan Miriello
Ok, since the client hosts their own mail server, I’ll contact them asking them if they have it configured this way. I’ll get back as soon as I get an answer.
Megan Miriello
The client could not find anything on their mail server. To recap my steps for testing:
Could there be an issue with Structure, possibly?
BoldMinded (Brian)
Have you tried creating a new user with a different email address to have the approvals sent to? E.g. an email address hosted on a different domain?
I’m not sure how Structure could play into this. Are all the entries you’ve tested managed by Structure? If so have you tried a channel not managed by structure?
Sorry I haven’t given any solid answers on this, but it just seems very peculiar b/c the email sending code does not run twice, and I feel like if this was an obvious bug I would be able to replicate it and I’d probably be getting similar reports from other users, which leads me to believe its something with your environment, but I don’t know what that is.
Megan Miriello
I’m using my email, which is a completely different domain and group form the client’s emails on the approval list. Tested to see if Structure was the issue by using a channel that wasn’t managed by Structure and it still sent duplicates. I created a local site and tested it (using the same method as before), it did not send duplicates. Could you explain what I can look for in the environment that could have caused this issue?
BoldMinded (Brian)
You only provided credentials to the live site FTP, which I won’t login to. I’ll only FTP to a dev or staging site. So, here is what you can do to debug this a bit. In addon.setup.php line 332 uncomment this function by removing the // in front of each line.
Then add this to line 205 of Service/Approval/ApprovalAbstract.php
Then save an entry to trigger the emails, then look in your cache folder for the file email-debug.txt and share the contents of that file here.
Megan Miriello
When I update add.setup.php on line 332, everything works fine, however, when I update ApprovalAbstract.php on line 205, the backend of the site 404s. If I delete the updated lines on 205, the backend is fine.
BoldMinded (Brian)
A PHP error wouldn’t throw a 404, that is a page not found. Are you sure another error isn’t being thrown, like a 500 error, and that you added the code correctly?
Megan Miriello
Sorry, I should have been more precise, it’s a HTTP ERROR 500. Here is the code from ApprovalAbstract.php that I have updated (starting from line 197 through 235):
And here is my code for addon.setup.php (lines 323 through 340)
BoldMinded (Brian)
You pasted the code wrong. Just add the following line, not the whole function name again.
So it looks like this
Megan Miriello
Sorry about that. Here is the log:
Megan Miriello
Also, I received three emails this time.
BoldMinded (Brian)
Ok, change that writeToFile line to this instead. It’ll save to a publisher.txt file I think in the same directory.
BoldMinded (Brian)
Same cache directory I mean.
Megan Miriello
I’m in the same directory as the email-debug.txt (web/system/user/cache) and unfortunately, I don’t see publisher.txt.
BoldMinded (Brian)
Search the rest of the cache directory, should be in publisher/log.txt
Megan Miriello
Just saw it, thanks. Here is the text:
BoldMinded (Brian)
On line 285 of Service/Entry/Entry.php add these lines
So it looks like this:
BoldMinded (Brian)
Delete the contents of publisher/log.txt before saving the entry again so those old debug lines are cleared out.
Megan Miriello
Ok, the text has been deleted and this the text I receive after testing.
Megan Miriello
Oh wait, disregard the last message. I didn’t see your new function. I’ll update after testing.
Megan Miriello
Here is the updated log:
BoldMinded (Brian)
Can you run this query on your database and share the results? It should find only 1 row.
Megan Miriello
Here is the results, just one:
231 Publisher_ext after_channel_entry_save after_channel_entry_save 5 2.8.2 y
BoldMinded (Brian)
It appears as if something is calling that function 3 times. Have you tried uninstalling all other add-ons except for Publisher on a local or dev site (backup db first) and seeing if the problem still exists?
BoldMinded (Brian)
Is anyone double clicking the save button by chance when saving an entry?
Megan Miriello
Ok, I’ll create a local of the site and test. I’m the only testing and I only click once on the save button.
Megan Miriello
Sorry for the delay. So, I created a local site of the client’s site. I was able to replicate the issue as the live site. I went ahead and uninstalled all plugins with the exception of Publisher Lite. I replicated the same steps as I did on the live site: Step 1: Login as a publisher. Step 2: Create a page, type in a title. Make the status draft. Check the box “send for Approval.”
I receive this NEW error after saving the page:
Step 3: I receive 2 duplicate emails (was three of the same emails earlier) and my email is the only one selected on the “Approval email list” setting.
BoldMinded (Brian)
Do you still have the logging code in mentioned in comment #31?
https://boldminded.com/support/ticket/1764#comment31
Megan Miriello
Sure, here is the log:
BoldMinded (Brian)
So it throws the “Array to string conversion” noticed and logs those two lines to the text file after saving an entry once? So every entry save creates 2 new identical lines in the log file? This doesn’t make any sense. I’ve never seen a hook get called twice like this.
Megan Miriello
I agree, I also thought that was very strange. I’m very careful to make sure I’m only clicking the save button once.
BoldMinded (Brian)
Is there a way to get this on a dev or staging site that I can login to? I really don’t like logging into production sites to debug, especially banking sites.
BoldMinded (Brian)
And by login to I mean FTP and CP access.
Megan Miriello
Sure, I’ve created a dev environment just for debugging. I was able to replicate the bug in this environment as well. If you need a back up for the database, please let me know. I couldn’t find any field in the “Edit Ticket” for a database upload. Let me know if you need anything else. Thanks!
BoldMinded (Brian)
It appears I don’t have permissions to edit any files. I need to be able to edit all files in the publisher folder and cache folder please.
Megan Miriello
I’ve updated permission. You should have access to everything now. Let me know if you need anything else.
Megan Miriello
Also, I noticed that ext.publisher.php is empty as of this moment. Is that intentional? I just want to make sure that I haven’t accidentally erased files while updating permissions.
BoldMinded (Brian)
ext.publisher.php should definitely not be empty 😊 Can you restore it from the version you’re using?
Megan Miriello
That explains the 500 http error. I have restored it for you. I have no idea why all of the php was deleted…
BoldMinded (Brian)
Every single hook on your site is getting called twice. Here is a CE Cache hook getting called twice
BoldMinded (Brian)
I feel like at this point you should talk to EllisLab, something isn’t right with your site, which is what I suspected days ago.
Megan Miriello
Ok, I’ve started a ticket with Ellislabs. Thank you for narrowing down the issue. I greatly appreciate it.
BoldMinded (Brian)
No worries. I’m going to keep this ticket open for a bit just in case.
Megan Miriello
Excellent! I can also pass the information along for the fix from Ellislabs if your interested.
Megan Miriello
Here is the response I received from Eillislabs:
What are your thoughts on this?
BoldMinded (Brian)
I’m not really sure what to think. Who at EL were you talking to? I’ll reach out to them directly and get the scoop.
Megan Miriello
I was consulting with Robin Sowell. Unfortunately, I don’t have an email address for you to directly contact Robin. I can inform Robin to contact you if you like.
BoldMinded (Brian)
I have her email and may be able to reach her on Slack. Thanks!
Megan Miriello
No problem! Happy to help.
BoldMinded (Brian)
James, in a dev/staging environment, backup your database and uninstall Structure, then see if it still sends 2 emails.
Megan Miriello
Uninstalled Structure and now it sends 3 duplicate emails.
BoldMinded (Brian)
This makes no sense. Did you ever setup a brand new EE site with Publisher installed to see how many emails it sends? I think at this point we have to be 100% sure it either Publisher, or something else with your current environment.
Megan Miriello
I agree that it doesn’t make sense. I did try a completely new local EE site environment with Publisher and Structure installed and I could not replicate the issue.
BoldMinded (Brian)
Have you disabled each add-on 1 at a time until it stops sending duplicate emails? If you can do that, then it may pin-point which add-on may be causing the issue.
Megan Miriello
When I created a local environment of the site, I did a test by disabling each add-on until it was just Publisher being installed and it still replicate the issue.
BoldMinded (Brian)
Try un-installing Publisher then, and re-installing then see if it still happens (backup db first obviously)
Megan Miriello
I’m using the local environment of the site, that has all of the plugins uninstalled and I deleted the plugin in the directory and uninstalled it on the control panel. I uploaded a fresh 2.8.3 Publisher Lite to the directory and installed it in the control panel. It now sends 2 duplicate emails.
BoldMinded (Brian)
I’m not sure what else to look into at this point. In the 6 years since Publisher’s release I’ve never seen this happen before. I’m still leaning towards something being out of whack with your environment, but I don’t know what it is.
Megan Miriello
Ok, thats fine. I will contact Ellislabs for further assistance. I greatly appreciate you helping me narrow down the issue. I agree that it’s a very strange issue.
Megan Miriello
Comment has been marked private.
BoldMinded (Brian)
James I’m not sure what to do with this. Debugging environmental issues is not included in the add-ons normal support. If this was repeatable on another server in another environment, then I’d spend more time digging into this, but as it is now it would be difficult to pin down without full root/shell access to the server, and even then I’m not sure where I’d start looking for something like this. I could spend hours (time I don’t really have) looking into this and turn up nothing. This may sound extreme, but have you considered spinning up a new server and redeploying the site to it, and switching DNS and all that? If it works fine on a new server, that may honestly be the path with least resistance.