Created
May 27, 2015 00:45
-
-
Save Zane5/30923f1910415188d1a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => "[email protected]", | |
:port => 25, | |
:user_name => '[email protected]', | |
:password => 'J35Q5uHQBD', | |
:authentication => 'login', | |
:enable_starttls_auto => true | |
} | |
Mail.defaults do | |
delivery_method :smtp, options | |
end | |
Mail.deliver do | |
to '[email protected]' | |
from '[email protected]' | |
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