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-YDxpq3io04c@public.gmane.org" 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Feb 14, 2012 at 10:32 AM, Christopher Jones <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>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-YDxpq3io04c@public.gmane.org" > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> ActionMailer::Base.smtp_settings = { > :address => "address", > :port => "port", > :user_name => "email", > :password => "password", > :authentication => "plain", > :enable_starttls_auto => trueHey 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Feb 14, 2012 at 11:44 AM, Christopher Jones <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
This is what I used.. 100% working.. @full_message = <<MESSAGE_END To: to-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 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-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org'', [''to-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org''] @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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> @full_message = <<MESSAGE_END > To: to-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Subject: its working! > > > This is a sample message > > MESSAGE_ENDSo 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-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org'', > [''to-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org''] > @sent=1 > end > endThe 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.