Skip to content

Instantly share code, notes, and snippets.

@tily
Created November 2, 2014 01:39
Show Gist options
  • Save tily/ec9d9c1dd41b8464ce32 to your computer and use it in GitHub Desktop.
Save tily/ec9d9c1dd41b8464ce32 to your computer and use it in GitHub Desktop.
require 'mail'
def main(args)
system *args
mail args
end
def mail(args)
message = "finished(#{$?.exitstatus}) : #{args.join(' ')}"
Mail.defaults do
delivery_method :smtp, {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => 'tidnlyam',
:password => ENV['PASSWORD'],
:authentication => 'plain',
:enable_starttls_auto => true
}
end
Mail.deliver do
to 'tidnlyam@gmail.com'
from 'tidnlyam@gmail.com'
subject message
body message
end
end
main(ARGV.dup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment