3

Ruby on Railsからメールを送信しようとしていますが、これを取得しています:

SocketError in UsersController#create
getaddrinfo: nodename nor servname provided, or not known

私のenvironments/development.rbファイルには次のものがあります。

  config.action_mailer.smtp_settings = { 
    address: "smtp.gmail.com",
    port: 587,
    domain: "my_company.org",
    authentication: "plain",
    enable_starttls_auto: true,
    user_name: "my_username@my_company.org",
    password: "my_pass"
  }

  config.action_mailer.delivery_method = :smtp

  config.action_mailer.default_url_options = { :host => 'localhost:5000' } 
  # 5000 rather than 3000 as I am using foreman.
4

2 に答える 2

8

Gmail を使用して同じことを行いました。以下は私の構成です。動作するかどうか試してみてください。

  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  ActionMailer::Base.smtp_settings = {
                    :address        => "smtp.gmail.com",
                    :port           => 587,
                    :authentication => :plain,
                    :user_name      => "<my gmail>@gmail.com",
                    :password       => "<my gmail password>",
                    :openssl_verify_mode  => 'none'
  } 

注意してください

:openssl_verify_mode  => 'none'

SSL エラーをスキップするセクション。

申し訳ありませんが、エラーの内容がわかりません。別のドメイン名で Gmail SMTP サーバーを使用しようとしている可能性があります。

于 2012-07-30T16:01:17.867 に答える