Created
March 30, 2010 13:26
-
-
Save koki-h/349097 to your computer and use it in GitHub Desktop.
pony_sample. A good wrapper of Net/SNMP + TMail
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
#ponyを使ってgmail経由でメールを送信 | |
#pony : http://github.com/benprew/pony | |
#メールクライアントの設定-GMailヘルプ : http://mail.google.com/support/bin/answer.py?hl=jp&answer=13287 | |
require 'rubygems' | |
require 'pony' | |
Pony.mail(:to => '[email protected]', | |
:body => "あああああああああああ", #bodyもsubjectも日本語OK(windows/cygwin) | |
:subject => "テストとととととt", | |
:charset => "utf8", #つけないと警告が出る | |
:via => :smtp, | |
:via_options => { | |
:enable_starttls_auto => true, #TLSを使う | |
:address => 'smtp.gmail.com', | |
:port => '587', #googleは465または587といっていたが465だとタイムアウトになる。 | |
:user_name => 'XXX', | |
:password => 'PASSPASSS', | |
:authentication => :plain, # gmailでは:plainでないとダメ | |
:domain => "gmail.com" # smtp.gmail.comでもOK | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment