We have multiple Zammad instances which were not able to send mails for some hours due to a network outage and we see the “unable to send email” notification box at a lot of tickets in the UI.
Delayed::Job.count is 0 for all instances so we assume Zammad has given up forever on retrying to send these emails?
Are there ways (presumably in the rails console) to:
a) find all tickets where email was not sent
b) re-create the jobs to send these emails?
(although not really meaningful i filled out the given points)
Expected behavior:
There is a clear way to determine and possibly re-send emails which did not leave Zammad due to a mail server outage. Possibly using the rails console.
Actual behavior:
Information in the documentation, forum and in github issues is unclear and offers no advice how to really examine the state or re-create jobs if that might be required
Steps to reproduce the behavior:
Let the outgoing mail server fail for a couple of hours
See the delivery failure messages at the tickets in the UI
Try to know:
a) if Zammad will re-send them if the mail server is available again after a longer down time
b) if not (a): if there is a way to find all tickets/articles in the system having a delivery failure
c) if (b) trigger the re-creation of the delivery job for all tickets
Here is the code we created to find all articles with delivery failures in the last 15 days for example. Prints out article id, date status, failure message if any.
failed = Ticket::Article.where('preferences like ?', '%delivery_status:%').where('preferences not like ?', '%delivery_status: success%').filter{ |x| x.preferences[:delivery_status_date] >= Time.now - 15.days }; failed.length
failed.each{ |x| puts "#{x.id} | #{x.preferences[:delivery_status_date]} | #{x.preferences[:delivery_status]} | #{x.preferences[:delivery_status_message]}"};1
This might be not the slickest code for the job, we’re ruby-n00bs
If you need to re-create the send-email-job for an article you need to call a private funtion on the article like this:
This solves most of our problem but the most important question remains: Would Zammad do this on it’s own somewhen after it encountered the 4 delivery failures?
Ok, this might be quite late
The code to re-send emails is the second one. You have to run it on every article object you want to re-send mails from. This might be all objects from the ‘failed’ list in the first code piece or only some. Depending on what you want to resend