2012-12-12 7 views
12

ZohoのアカウントからEメールを送るには誰もがActionMailerを設定していますか?ZohoのためのRails ActionMailerの設定

これらは私の設定です:しかし

ActionMailer::Base.smtp_settings = { 
    :address    => "smtp.zoho.com", 
    :port     => 465, 
    :domain    => 'example.com', 
    :user_name   => '[email protected]', 
    :password    => 'n0tmypa$$w0rd', 
    :authentication  => :login 
} 

、外.deliver回の呼び出し:

irb(main):001:0> AdminMailer.signup_notification('asfd').deliver 
Timeout::Error: Timeout::Error 
     from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill' 
     from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill' 
     from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' 
     from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' 
     from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:929:in `recv_response' 
     from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:552:in `block in do_start' 
     from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:939:in `critical' 
     from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:552:in `do_start' 
     from C:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:519:in `start' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!' 

help docsは、ポート465とSSL認証を使用するように言います。私は:enable_starttls_auto => trueの有無にかかわらず試しましたが、それでもタイムアウトします。

>  Email Address: [email protected] 
>  User Name format: [email protected] 
>  Secure Connection (SSL) Yes 
>  Outgoing Mail Server Name: smtp.zoho.com 
>  Outgoing Port No.: 465 
>  Outgoing Mail Server requires authentication: Yes 

任意のアイデア:

具体的には、docsは、次の設定を指定しますか?

p.s.私はhelp docsの設定を使用するためにOutlookを設定し、送信メールは正常に動作します。 smtp.zoho.comへのtelnet 465も接続します。

+0

ローカルホストから試していますか? – Jean

+0

もちろん、SMTPサーバーはリモート(zoho.com)です。これは問題だろうか? – lambinator

+0

Outlookを使用するかどうかわからない場合、マイクロソフトは電子メールの確認などの必要な場合でも、アプリケーションからの送信メールを許さないようです。 – Noz

答えて

29
# Action Mailer 
ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = {    
    :address    => "smtp.zoho.com", 
    :port     => 465,     
    :user_name   => '[email protected]', 
    :password    => 'password',   
    :authentication  => :login, 
    :ssl     => true, 
    :tls     => true, 
    :enable_starttls_auto => true  
} 

それは私のために働いた。ローカルネットワークによっては、この種のパケットがブロックされている可能性があります。私は3Gネットワ​​ークを通じてそれをテストしなければならなかった。

+1

はdelivery_methodを省略しました。 :S – lambinator

+0

誰もがSpreeでこれらの設定を試しましたか? –

+1

保存された私の一日! :) – vellotis

0

Zohoがセキュリティ設定を変更したのかどうかは分かりませんが、@Tyrel Richeyの回答がうまくいきませんでした。ただし、次のことを行います。

/config/initializers/action_mailer.rb ..

 
# ActionMailer email configuration 
ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = { 
    :address    => ENV['SMTP_ADDRESS'], 
    :port     => ENV['SMTP_PORT'], 
    :domain    => ENV['SMTP_DOMAIN'], 
    :user_name   => ENV['SMTP_USERNAME'], 
    :password    => ENV['SMTP_PASSWORD'], 
    :authentication  => :login, 
    :enable_starttls_auto => true 
} 

...
:address = smtp.zoho.com
:port = 587
:domainは開発中のlocalhostあり、かつ生産(例えばでのライブURL example.com

+0

ポートが465である必要があります。sslとtlsをtrueに設定してください。 –

+0

@DankeXie、ありがとう:) –

3

FYI:

あなたのドメインはabc.comとしましょう。
別のドメインのメーラーで「デフォルトから」があるとします。あなたのZohoアカウントで同じドメインを使用してあなたの「からデフォルト」を変更しない限り

default from: "\"Elephant\" <[email protected]>" 

このを動作しません。
ので、

default from: "\"Elephant\" <[email protected]>" 

は動作します。

0

私はあなたがもちろん私もメールアドレスを設定しconfig/environments/production.rb

にこれを追加することで、同様の生産にこれを使用することができますので...

# config/environments/development.rb 
Rails.application.configure do 
#... 
    config.action_mailer.default_url_options = { host: 'domain' } 
    config.action_mailer.smtp_settings = { address: 'smtp.zoho.com', port: 465, user_name: '[email protected]', password: 'mypassword', authentication: :login, ssl: true } 
end 

のようなRailsの4.2.3でメール送信を持っていますconfig/initializers/devise.rbでパスワードリセットの指示を送ることができます。

config.mailer_sender = '[email protected]' 


参照

0

これらの設定は、生産に私のために働きました。

Rails.application.routes.default_url_options[:host] = 'eyehawk.io' 
    config.action_mailer.default_url_options = { :host => 'eyehawk.io' } 
    config.action_mailer.perform_caching = false 

    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" 

    config.action_mailer.smtp_settings = { 
     :address    => "smtp.zoho.com", 
     :port     => 587, 
     :domain    => "zoho.com", 
     :user_name   => "[email protected]", 
     :password    => ENV['SMTP_PASSWORD'], 
     :authentication  => :plain, 
     :enable_starttls_auto => true 
    } 
関連する問題