佳丽

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#encoding:utf-8
require 'mail'
def send_email sum,fail,case_path,name,receive
smtp = { :address => '***', :port => 25, :domain => '***',
:user_name => '****', :password => '***',
:enable_starttls_auto => true, :openssl_verify_mode => 'none' }
Mail.defaults { delivery_method :smtp, smtp }
mail = Mail.new do
from '****'
to receive
subject '自动化测试报告'
body "各位好:
附件为#{name.encode('utf-8')},请查看。
总结如下:本次回归共#{sum}个用例,失败#{fail}个

"
add_file File.expand_path(case_path)
end
mail.deliver!
end
posted on 2016-09-07 19:14  佳丽  阅读(335)  评论(0编辑  收藏  举报