I am trying to set up a mailer to send myself notification methods. I am
currently trying to get the mailer to send myself a simple message when I
go to the URL `localhost:3000/send_mail`

I am currently getting this error:

     Net::SMTPAuthenticationError in HomeController#send_mail
     534-5.7.9 Application-specific password required

development.rb:

       config.action_mailer.raise_delivery_errors = true
       host = 'localhost:3000'
       config.action_mailer.default_url_options = { host: host }
       config.action_mailer.delivery_method = :smtp
       config.action_mailer.smtp_settings = {
         address: 'smtp.gmail.com',
         port: 587,
         domain: 'gmail.com',
         user_name: 'myemail@gmail.com',
         password: 'mypwd',
         authentication: 'plain',
         enable_starttls_auto: true }

routes:

    match '/send_mail', to: "home#send_mail", via: "get"

home controller:

     class HomeController < ApplicationController
       def index
       end

       def send_mail
       ActionMailer::Base.mail(:from => "me@example.com", :to =>
"myemail@gmail.com", :subject => "Contact request", :body =>
"test").deliver_now
         render nothing: true
       end
     end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/904d2d19-b058-4150-ba98-06279ce8c966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Wdperson at Nov 18, 2014 at 8:33 pm
    Hello,

    The reason you are getting that error is because more than likely you have
    set up 2 factor authentication with Google/Gmail. So it is saying you need
    to include a application specific password. In other words don't use the
    usual login password, create an application specific password on
    Google/Gmail and then use that in your smtp settings. Hope this helps.

    Mike Riley

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/18377bb1-73d8-4c5d-8022-01442b7f3e60%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Bradford li at Nov 18, 2014 at 8:42 pm
    Thank you!! worked like a charm!
    On Tuesday, November 18, 2014 12:33:25 PM UTC-8, wdperson wrote:

    Hello,

    The reason you are getting that error is because more than likely you have
    set up 2 factor authentication with Google/Gmail. So it is saying you need
    to include a application specific password. In other words don't use the
    usual login password, create an application specific password on
    Google/Gmail and then use that in your smtp settings. Hope this helps.

    Mike Riley
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3df55c3e-d594-48bc-9eae-b497032b4af5%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Rob Biedenharn at Nov 18, 2014 at 8:34 pm
    Take a look at:
    https://support.google.com/accounts/answer/185833?hl=en

    -Rob
    On 2014-Nov-18, at 15:22 , bradford li wrote:

    I am trying to set up a mailer to send myself notification methods. I am currently trying to get the mailer to send myself a simple message when I go to the URL `localhost:3000/send_mail`

    I am currently getting this error:

    Net::SMTPAuthenticationError in HomeController#send_mail
    534-5.7.9 Application-specific password required

    development.rb:

    config.action_mailer.raise_delivery_errors = true
    host = 'localhost:3000'
    config.action_mailer.default_url_options = { host: host }
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
    address: 'smtp.gmail.com',
    port: 587,
    domain: 'gmail.com',
    user_name: 'myemail@gmail.com',
    password: 'mypwd',
    authentication: 'plain',
    enable_starttls_auto: true }

    routes:

    match '/send_mail', to: "home#send_mail", via: "get"

    home controller:

    class HomeController < ApplicationController
    def index
    end

    def send_mail
    ActionMailer::Base.mail(:from => "me@example.com", :to => "myemail@gmail.com", :subject => "Contact request", :body => "test").deliver_now
    render nothing: true
    end
    end

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/904d2d19-b058-4150-ba98-06279ce8c966%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3B82D324-8DDF-4589-BD19-34B857AE00A4%40agileconsultingllc.com.
    For more options, visit https://groups.google.com/d/optout.
  • Bradford li at Nov 18, 2014 at 8:42 pm
    thank you!!! worked perfectly!!
    On Tuesday, November 18, 2014 12:34:39 PM UTC-8, Rob Biedenharn wrote:

    Take a look at:
    https://support.google.com/accounts/answer/185833?hl=en

    -Rob

    On 2014-Nov-18, at 15:22 , bradford li <bradf...@gmail.com <javascript:>>
    wrote:

    I am trying to set up a mailer to send myself notification methods. I am
    currently trying to get the mailer to send myself a simple message when I
    go to the URL `localhost:3000/send_mail`

    I am currently getting this error:

    Net::SMTPAuthenticationError in HomeController#send_mail
    534-5.7.9 Application-specific password required

    development.rb:

    config.action_mailer.raise_delivery_errors = true
    host = 'localhost:3000'
    config.action_mailer.default_url_options = { host: host }
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
    address: 'smtp.gmail.com',
    port: 587,
    domain: 'gmail.com',
    user_name: 'mye...@gmail.com <javascript:>',
    password: 'mypwd',
    authentication: 'plain',
    enable_starttls_auto: true }

    routes:

    match '/send_mail', to: "home#send_mail", via: "get"

    home controller:

    class HomeController < ApplicationController
    def index
    end

    def send_mail
    ActionMailer::Base.mail(:from => "m...@example.com <javascript:>",
    :to => "mye...@gmail.com <javascript:>", :subject => "Contact request",
    :body => "test").deliver_now
    render nothing: true
    end
    end

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to rubyonrails-ta...@googlegroups.com <javascript:>.
    To post to this group, send email to rubyonra...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/rubyonrails-talk/904d2d19-b058-4150-ba98-06279ce8c966%40googlegroups.com
    <https://groups.google.com/d/msgid/rubyonrails-talk/904d2d19-b058-4150-ba98-06279ce8c966%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8653f314-4504-4902-b443-e73730e0a967%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 18, '14 at 8:22p
activeNov 18, '14 at 8:42p
posts5
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase