Forum: Ruby on Rails Mandrill mail problem

18234c3c6b04ac08d8afb1eeb2e20269?d=identicon&s=25 Avi (Guest)
on 2013-09-11 09:10
(Received via mailing list)
Hello All,

I am trying to use Mandrill api in my rails app.
I am getting this error every time:-

Net::SMTPServerBusy (401 4.1.7 Bad sender address syntax)

I am using Ruby - 1.9.3, rails - 3.2.8, Thin server, & Ubuntu 12.10.

in Gemfile:-
gem "mandrill-api", "~> 1.0.45"
gem 'mandrill_mailer'

application.rb:-

config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
        :address   => "smtp.mandrillapp.com",
        :port      => 587,
        :user_name => ENV["some email"],
        :password  => ENV["api key"],
        :authentication => 'login'
    }

In mailer.rb:-

def verify_code(user)
    mail(:to => user.email,  :subject => "TEXT") do |format|
      format.html
    end
  end

In controller:-

UserMailer.verify_code(resource).deliver  # Here resource is the user
object

What am I doing wrong here?



Thanks,
Avinash
14b5582046b4e7b24ab69b7886a35868?d=identicon&s=25 Joel Pearson (virtuoso)
on 2013-09-11 18:00
What are you using as the sender (from) address?
18234c3c6b04ac08d8afb1eeb2e20269?d=identicon&s=25 Avi (Guest)
on 2013-09-19 08:32
(Received via mailing list)
Hello,

Sorry for late reply.

I am getting this error:-

   - *Net::SMTPServerBusy (401 4.1.7 Bad sender address syntax.)*


*TOTAL CODE:- *


   - Rails- 3.2.8, Ruby-1.9.3, Thin server


   - In Gemfile:-
   - gem 'mandrill_mailer'


   - In application.rb:-
      - config.action_mailer.smtp_settings = {
      -         :address   => "smtp.mandrillapp.com",
      -         :port      => 587,
      -         :enable_starttls_auto => true,
      -         :user_name => "E <registration@olamundo.com>MAIL",
      -         :password  => "*API KEY*",
      -         :authentication => 'login',
      -         :domain => 'h <http://olamundo.com/>eroku.com'  # what
is
      the domain here?
      -     }


   - In devise.rb:-
      - Devise.setup do |config|
      -         config.mailer_sender = "M
<registration@olamundo.com>AIL"
      -         config.mailer = "Devise::Mailer"
      - end


   - In my registration_controller.rb:-
      - UserMailer.verify_code(resource).deliver
      - We are using* Devise. Resource *here is the* user object.*


   - In mailer.rb:-
      -
      - def verify_code(user)
      -     mail(:to => user.email,  :subject => "Hello") do |format|
      -       format.html
      -     end
      -   end





On Wednesday, September 11, 2013 9:30:19 PM UTC+5:30, Ruby-Forum.com
User
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.