2016-08-02 14 views
1

新しい英語グレードが作成されたときに電子メールを送信しようとしています。このアプリでは、Studentが継承された(STI)タイプのユーザーであり、先生(別のタイプの継承したユーザーであるユーザー)がグレードを作成したときにメールを送信しようとしています。メーラエラー英語版NetAgent:SMTPAuthenticationErrorGreatdesController#create

現時点では、gmailを使用してローカルで動作させようとしています。私は

rails g mailer UserMailer 

をセットアップするために使用しました。

これは、英語グレードを作成したときに発生するエラーです。

ネット:: SMTPAuthenticationError EnglishGradesControllerで#は

530-5.5.1認証が必要を作成します。上記

(**強調表示エラーである)

@student = Student.find_by_id(@english_grade.student_id) 
    if @english_grade.save 
    **UserMailer.new_grade(@student).deliver** 
    redirect_to(student_path(@student), :notice => "Post was successfully created.") 
    else // etc 

で詳細をご覧ください、私はそれを繰り返すことはしませんので、私は、メーラーを呼んでいるところもあります。

マイdevelopment.rbファイル:

config.action_mailer.raise_delivery_errors = true 

config.action_mailer.delivery_method = :smtp 

config.action_mailer.default_url_options = { :host => "my ip address" } 

config.action_mailer.smtp_settings = { 
:address    => "smtp.gmail.com", 
:domain => 'my ip address:3000', //where 3000 is the port I'm running on locally 
:port     => 587, 
:user_name   => ENV['[email protected]'], 
:password    => ENV['password'], 
:authentication  => "plain", 
:enable_starttls_auto => true 
} 

    config.action_mailer.perform_caching = false 

私のメーラー:

class UserMailer < ApplicationMailer 
default from: "[email protected]" 

    def new_grade(user) 
    @user = user 
    mail to: @user.email, subject: "New grade created" 
    end 

end 

他Qsののいくつかを読んでから:

私は "なしで試してみましたdevelopment.rbでドメイン: 'ホストIPアドレスのものを持たないで

私は試した: http://www.google.com/accounts/DisplayUnlockCaptcha

は、私はまた、安全性の低いアプリのhttps://www.google.com/settings/security/lesssecureapps

のためのアクセスを許可している私は、複雑な

何かに自分のパスワードを変更した私はまた、465にポートを変更しようとしましたが、ファイル・エラーの終わりを得ました。それはどんな関連があります場合

はまた、私は任意の助けをいただければ幸いアプリ

のための電子メールを送信するために特別に、今日、このGmailアカウントを作成し、感謝!

答えて

0

問題があることを必要とさ

:authentication  => "plain", 

実際ました:

:authentication  => "login", 
関連する問題