-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail_email.rb
27 lines (24 loc) · 955 Bytes
/
mail_email.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 请事先安装好 mail 库: gem install mail
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "smtp.163.com",
:port => 25,
:user_name => "[email protected]",
:password => "******",
:enable_starttls_auto => false,
:openssl_verify_mode => 'none' }
retriever_method :pop3, { :address => "pop.163.com",
:port => 995,
:user_name => "[email protected]",
:password => "******",
:enable_ssl => true }
end
# mail = Mail.deliver do
# to '[email protected]'
# from '[email protected]'
# subject '测试文件,勿回'
# text_part do
# body 'Testing mail 测试文件,勿回 测试文件,勿回 测试文件,勿回'
# end
# end
p Mail.last