How to find and resend undelivered EMails

Infos:

  • Used Zammad version: 6.0.0
  • Used Zammad installation type: docker-compose
  • Operating system: Linux
  • Browser + version: Not applicable

Actual question

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
1 Like

Half topic: is there a method to reopening tickets or mention the owner if delivery fails?
Because a non-compliant e-mail address is also possible.

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 :slight_smile:

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:

theArticleInstance.method(:ticket_article_enqueue_communicate_email_job).call()`

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?

2 Likes

ohhh thank you very much, with your code i could find which tickets have failed mails…

but i dont get to “resend” a mail, could you explain more?

Ok, this might be quite late :grimacing:
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