LoginSignup
5
6

More than 5 years have passed since last update.

Sinatraでponyを使ってメールを送る

Posted at

gmailから送信する場合は、GitHubに書いてるとおりですが、それ以外の場合、:enable_starttls_auto、:openssl_verify_modeを追加しないとダメでした。

filename
    Pony.mail(
            :from => 'me@example.com',
            :to => 'you@example.com',
            :bcc => ['him@example.com', 'her@example.com'],
            :subject => "Hi!",
            :html_body => "Hello, world!",
            :via => :smtp,
            :via_options => { 
              :address             => '*****', 
              :port                 => '587', 
              :user_name            => 'user', 
              :password             => 'password', 
              :authentication       => :plain,
              :enable_starttls_auto => false,
              :openssl_verify_mode  => OpenSSL::SSL::VERIFY_NONE
            })
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6