Forum: Ruby on Rails both user and secret are required, an error from sending ema

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B4bc9eb8cafd27b83f686d8263d4fa41?d=identicon&s=25 Maricris Nonato (kristeta126)
on 2007-01-06 09:36
Hi,

Can anybody please tell me what this error means?

"both user and secret are required"

I was trying to send an email.  I had my environment.rb configured to
have the following (because I was running in development):

ActionMailer::Base.server_settings = {
  :address  => "smtp.myrealdomain.net",
  :port  => 25,
  :username => 'myusername',
  :password => 'mypassword',
  :authentication => 'plain'

}

and my model goes like this:

class Notifier < ActionMailer::Base
  def update_email( user )
    @recipients = "me@myemailcom"
    @from = "m...@gmail.com"
    @subject = "New Email Address Information"

    # Email body variable substitutions go here
    @body["firstname"] = user.firstname
    @body["lastname"] = user.lastname
    @body["activation"] = user.activation
    @body["password"] = user.password
    @body["username"] = user.username
  end
end

and I invoke it from my method as such:

    def updateEmailDetail
          @cuser = User.find(params[:current_user][:id])
          ...
           if @cuser.update_attributes(params[:current_user])
             flash['notice'] = 'Successful update'
             Notifier::deliver_update_email(@cuser)
           else
             flash['error'] = 'An error occurred.'
           end
         ...
      redirect_to :controller => 'home', :action => 'acct', :cat =>
'account'
    end

When I do execute the method, I get the error "both user and secret are
required".  Does any body know what this means?  I hope someone might
see this post and shed some light.   Is there something wrong about the
way I called it?

Many thanks!
This topic is locked and can not be replied to.