#!/usr/bin/env ruby
#
# Send a test email to the specified email address. This is used
# to check that Ruby email sending is working.
#
#
require 'rubygems'
require 'mail'

#Mail.defaults do
#  delivery_method :smtp, { 
#    :address => 'smtp.gmail.com',
#    :port => '587',
#    :user_name => 'tooltwist.notifications@gmail.com',
#    :password => 'myFancyPassword',
#    :authentication => :plain,
#    :enable_starttls_auto => true
#  }
#end


def send_deploy_result(resultTo, resultSubject, resultBody, attachments)
  mail = Mail.new do
    body resultBody 
    #File.read('body.txt')
  end
  
  mail['from'] = 'tooltwist.notifications@gmail.com'
  mail[:to]    = resultTo
  mail.subject = resultSubject
  
  attachments.each do |file|
    mail.add_file(file)
  end
  
  mail.deliver!
end

