27 lines
648 B
Plaintext

namespace :send do
namespace :mail do
desc "Send an email when deploy is finished"
task :notify do
if Capistrano::Send::Mail.supported?
config = fetch(:send_mail, {})
invoke 'send:set_release_log'
body = revision_log_message << "\n\n"
body << "Changes:\n#{fetch(:release_log)}"
Mail.deliver do
to config[:to]
from config[:from]
subject "Deploy successful on #{fetch(:stage)}!"
body body
delivery_method config[:via] || :smtp, config[:via_options] || {}
end
end
end
end
end
after 'deploy:finished', 'send:mail:notify'