Cannot receive from specified address Unauthenticated senders not allowed

On trying to run a rake task via crontab, I’m getting the following
error:

rake aborted!
550 Cannot receive from specified address <[email protected]>:

Unauthenticated senders not allowed
/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/network/delivery_methods/smtp.rb:129:in
`block in deliver!’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/network/delivery_methods/smtp.rb:128:in
`deliver!’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/message.rb:1989:in
`do_delivery’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/message.rb:230:in
`block in deliver’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/actionmailer-3.1.10/lib/action_mailer/base.rb:432:in
`block in deliver_mail’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.10/lib/active_support/notifications.rb:53:in
`block in instrument’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.10/lib/active_support/notifications/instrumenter.rb:21:in
`instrument’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.10/lib/active_support/notifications.rb:53:in
`instrument’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/actionmailer-3.1.10/lib/action_mailer/base.rb:430:in
`deliver_mail’

/mnt/voylla-production/shared/bundle/ruby/1.9.1/gems/mail-2.3.3/lib/mail/message.rb:230:in
`deliver’

/mnt/voylla-production/releases/20131111011431/app/controllers/admin/order_query_controller.rb:255:in
`send_last_2_days_orders’

/mnt/voylla-production/releases/20131111011431/lib/tasks/env_setup.rake:116:in
`block (2 levels) in <top (required)>’
Tasks: TOP => maintenance:last_2_days_orders
(See full trace by running task with --trace)

My production.rb is:

config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.force_ssl = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.action_mailer.default_url_options = {:host =>'xyz.com'}
config.action_mailer.smtp_settings = {
  :address        => 'smtp.sendgrid.net',
  :port           => '587',
  :authentication => :plain,
  :user_name      => ENV['SENDGRID_USERNAME'],
  :password       => ENV['SENDGRID_PASSWORD'],
  :domain         => 'xyz.com'
}
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :from => "xyz Help <[email protected]>"
config.mailer_sender = "xyz Help <[email protected]>"
config.action_mailer.default_url_options = { :host => "xyz.com" }

I’ve looked through similar posts, and I feel my production.rb is
configured correctly. So, I’m not able to figure out what’s the problem.

Please could someone help. Thanks

EDIT: Could changes in Gemfile.lock casue this? My Gemfile.lock got
changed, although I had reverted the changes later. It worked fine
earlier.=

On Nov 13, 2013, at 7:13 AM, Nishant S. [email protected]
wrote:

On trying to run a rake task via crontab, I’m getting the following error:

rake aborted!
550 Cannot receive from specified address <[email protected]>: Unauthenticated 

senders not allowed

You should check that [email protected] is in fact authenticated make sure
ENV[‘SENDGRID_USER’] and ENV[‘SENDGRID_PASSWORD’] are indeed correctly
set in your production environment prior to starting up Rails.

Hi,

I am sure I have set the username and password correctly. Its working on
staging environment.

Thanks