Skip to content

Instantly share code, notes, and snippets.

@koki-h
Created March 30, 2010 13:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save koki-h/349097 to your computer and use it in GitHub Desktop.
Save koki-h/349097 to your computer and use it in GitHub Desktop.
pony_sample. A good wrapper of Net/SNMP + TMail
#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 => 'XXX@XXXX.com',
: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