Skip to content

Instantly share code, notes, and snippets.

@vidmantas
Created June 30, 2011 09:16
Show Gist options
  • Save vidmantas/1055910 to your computer and use it in GitHub Desktop.
Save vidmantas/1055910 to your computer and use it in GitHub Desktop.
Reset frozen exim messages with ruby
# deliver with this or fetch results with `exiqgrep -zi` and deliver with `exim -M <message-id>`
require 'mail'
Dir.chdir("/var/spool/exim4/input")
frozen_email_ids = `exiqgrep -zi`.split
frozen_email_ids.each do |eid|
# fetch the body
email_string = "Date:" << File.read("#{eid}-D").split("Date:").last
email = Mail.parse_from_string(email_string)
email.deliver
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment