Quantcast
Channel: Zammad - Community - Latest posts
Viewing all articles
Browse latest Browse all 6709

How to find and resend undelivered EMails

$
0
0

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?


Viewing all articles
Browse latest Browse all 6709

Trending Articles