Hey all, well I am trying to send emails to newly created users but I
have a problem.

In the rails log it states that the email has been sent but the email is
never actually received so obviously there is a problem.

I have noticed one in particular and I don't understand how to fix it.
Once I create the user I get the following error message:

Net::SMTPAuthenticationError (535-5.7.1 Username and Password not
accepted.

How do I set a username and password?

I have the following in my development.rb:

config.action_mailer.raise_delivery_errors = false

# config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
:address => "smtphost.aber.ac.uk",
:port => 25,
:domain => "Christopher-PC"
}
ADMIN_EMAIL="chris230391@aol.com"

Any help would be much appreciated. Thanks.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Javier Quarite at Feb 14, 2012 at 3:36 pm

    On Tue, Feb 14, 2012 at 10:32 AM, Christopher Jones wrote:
    I have the following in my development.rb:

    config.action_mailer.raise_delivery_errors = false

    # config.action_mailer.delivery_method = :smtp

    config.action_mailer.smtp_settings = {
    :address => "smtphost.aber.ac.uk",
    :port => 25,
    :domain => "Christopher-PC"
    }
    ADMIN_EMAIL="chris230391@aol.com"

    Any help would be much appreciated. Thanks.
    ActionMailer::Base.smtp_settings = {
    :address => "address",
    :port => "port",
    :user_name => "email",
    :password => "password",
    :authentication => "plain",
    :enable_starttls_auto => true
    }


    I use this settings.... maybe it can help, but it's in an initializers file


    Javier Q.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Christopher Jones at Feb 14, 2012 at 4:44 pm

    ActionMailer::Base.smtp_settings = {
    :address => "address",
    :port => "port",
    :user_name => "email",
    :password => "password",
    :authentication => "plain",
    :enable_starttls_auto => true
    Hey Javier, I added the above settings to my development.rb and I no
    longer get the username and password error, it allows me to create the
    new user no problems at all which is great except one major problem,
    despite the log stating that the email has been sent I have received
    nothing :/

    Any ideas?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Javier Quarite at Feb 14, 2012 at 5:24 pm

    On Tue, Feb 14, 2012 at 11:44 AM, Christopher Jones wrote:

    ActionMailer::Base.smtp_settings = {
    :address => "address",
    :port => "port",
    :user_name => "email",
    :password => "password",
    :authentication => "plain",
    :enable_starttls_auto => true
    Hey Javier, I added the above settings to my development.rb and I no
    longer get the username and password error, it allows me to create the
    new user no problems at all which is great except one major problem,
    despite the log stating that the email has been sent I have received
    nothing :/

    Any ideas?
    Have you considered using Devise gem? it has that option (sending emails
    every time a user is created). I'm not using it now.
    Inside my app folder I have a mailers folder an inside a user_mailer.rb

    class UserMailer < ActionMailer::Base
    default from: "Name <email>"

    def sender_method_name_here( user , something_else)
    @user = user
    @data = "something_else"
    mail :to => @user.email, :subject => "subject"
    end
    end

    but this is even easier with devise (I don't remember well but you can see
    the documentation of it in github

    Javier Q.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Christopher Jones at Feb 14, 2012 at 7:18 pm
    I have the following in my user_mailer.rb similar to you but it doesn't
    seem to work for me:


    class UserMailer < ActionMailer::Base
    default :from => "notifications@example.com"

    def registration_confirmation(user)
    @user = user
    @url = "http://localhost:3000"
    mail(:to => user.email,:subject => "Welcome")
    end
    end


    Pretty much stumped at this point because everything I have is by the
    book so why doesn't it work.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Christian Bautista at Feb 15, 2012 at 8:32 am
    This is what I used..

    100% working..

    @full_message = <<MESSAGE_END
    To: to@gmail.com
    Subject: its working!


    This is a sample message

    MESSAGE_END
    @sent=0
    smtp = Net::SMTP.new('smtp.gmail.com', 25)
    smtp.enable_starttls

    smtp.start('mail.google.com',username, password, :login) do |smtp|
    if @sent==0
    smtp.send_message @full_message, 'from-address@example.com',
    ['to@email.com']
    @sent=1
    end
    end

    hope this helped you..
    No gem require

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Christopher Jones at Feb 17, 2012 at 1:42 pm

    @full_message = <<MESSAGE_END
    To: to@gmail.com
    Subject: its working!


    This is a sample message

    MESSAGE_END
    So the above is your text.rb message?
    @sent=0
    smtp = Net::SMTP.new('smtp.gmail.com', 25)
    smtp.enable_starttls

    smtp.start('mail.google.com',username, password, :login) do |smtp|
    if @sent==0
    smtp.send_message @full_message, 'from-address@example.com',
    ['to@email.com']
    @sent=1
    end
    end
    The above code, where is this stored? is it in the development.rb? is
    this all it is or is it incased in a method?

    Appreciate the help. Thanks.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 14, '12 at 3:33p
activeFeb 17, '12 at 1:42p
posts7
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase