Skip to content

Instantly share code, notes, and snippets.

@fgbreel
Created September 3, 2015 05:12
Show Gist options
  • Save fgbreel/5b97d1819ecbda73a75f to your computer and use it in GitHub Desktop.
Save fgbreel/5b97d1819ecbda73a75f to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'mailman'
class ErrorLoggingMiddleware
def call(mail)
begin
yield
rescue
puts "There was an error processing this message! #{mail.subject}"
raise
end
end
end
Mailman.config.middleware.add ErrorLoggingMiddleware
Mailman.config.poll_interval = 10
Mailman.config.imap = {
server: 'imap.gmail.com',
port: '993',
ssl: true,
username: ENV['EMAIL_ADDRESS'],
password: ENV['EMAIL_SECRET']
}
Mailman::Application.run do
from('[email protected]').subject(/PagerDuty ALERT/) do
`open ~/Downloads/pagerduty.mp3`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment