Created
September 3, 2015 05:12
-
-
Save fgbreel/5b97d1819ecbda73a75f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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