2016-07-07 4 views
0

私は2つの方法でactionmailerを使用しました。 Gmailのsmtpを設定した最初のメール: -actionmailerのレールを使用すると実行が終了しました4

config.action_mailer.default_url_options = { :host => 'localhost:3000' } 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.raise_delivery_errors = true 
    config.action_mailer.default :charset => "utf-8" 
    ActionMailer::Base.delivery_method = :smtp # be sure to choose SMTP delivery 
    ActionMailer::Base.smtp_settings = { 
    :address    => "smtp.gmail.com", 
    :port     => "587", 
    :domain    => "gmail.com", 
    :user_name   => "[email protected]", 
    :password    => "some-password", 
    :authentication  => "plain", 
    :enable_starttls_auto => true 
    } 

これはとてもうまく動作します。メールが送られました。私は設定して自分のサーバーに自分のメールサーバーを使用することを決定したとき

問題がある: -

config.action_mailer.default_url_options = { :host => 'localhost:3000' } 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.raise_delivery_errors = true 
    config.action_mailer.default :charset => "utf-8" 
    ActionMailer::Base.delivery_method = :smtp # be sure to choose SMTP delivery 
    ActionMailer::Base.smtp_settings = { 
    :address    => "mail.xgram.xyz", 
    :port     => "25", 
    :domain    => "xgram.xyz", 
    :user_name   => "[email protected]", 
    :password    => "some-password", 
    :authentication  => "plain", 
    :enable_starttls_auto => true 
    } 

この構成では、私は、端末

ネット::です。OpenTimeout(このエラーを得ました実行は)期限切れ:

と、ブラウザでこのエラー

実行はまた

期限切れ私は任意の名前に変更したときに、エラーが

のgetaddrinfoとなりますので、サーバー名としてmail.xgram.xyzは、有効である:名前またはサービス

を知られていません

誰でも助けてくれますか? ありがとうございます

答えて

0

サーバ設定でipv6を無効にする必要があります。完了したらエラーは表示されません。

+0

オペレーティングシステム、ApacheのWebサーバー構成、またはレール構成に関連するシステム構成を意味しましたか? – omarzouk

+0

OSに関連する設定。これを参照してください 'http://stackoverflow.com/a/26518579/2657566' –

+0

私はこれはIPv6の問題ではないと思う。コメントの質問では、同僚はすでに私と一緒にうまく動作しているGmailの設定を使用していました。私の問題は、自分のSMTPを設定するときです。 – omarzouk

関連する問題