Skip to content

Instantly share code, notes, and snippets.

@Zane5
Created May 27, 2015 00:45
Show Gist options
  • Save Zane5/30923f1910415188d1a0 to your computer and use it in GitHub Desktop.
Save Zane5/30923f1910415188d1a0 to your computer and use it in GitHub Desktop.
require 'mail'
require 'date'
yesterday=Date.today.prev_day.strftime("%Y%m%d")
yesterdayLogFile="./" + yesterday + ".log"
subject="技术指标 " + yesterday
body="请查看附件。"
options = {
:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
:address => "mail.@example.com",
:port => 25,
:user_name => 'push@example.com',
:password => 'J35Q5uHQBD',
:authentication => 'login',
:enable_starttls_auto => true
}
Mail.defaults do
delivery_method :smtp, options
end
Mail.deliver do
to 'z@example.com'
from 'push@example.com'
subject subject
body body
add_file :filename => 'technical_index', :content => File.read(yesterdayLogFile)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment