ruby - Sidekiq and rails 4 actionmailer never delivers emails -


i've setup sidekiq in rails 4 application sending emails , processing background jobs. have devise using devise_async , typical contact form emailer. using gmail sending emails.

if remove sidekiq, sends emails through gmail (both devise , contact form) when enabling it, doesn't work (neither devise_async neither contact form). sidekiq shows background jobs starts , finishes (i see them through sinatra app it's been processed) email never been delivered.

in development, console shows emails sent (both devise_async , contact form, processed sidekiq successfully).

what i've have try:

  • i've added github branch rails4 of sidekiq (i've tried master)
  • i've updated , check redis version greater 2.4 (it's 2.6.14)
  • i running sidekiq bundle exec sidekiq

but nothing worked. using ruby 2.0.0-p247.

i have setup image processing sidekiq in app , works both in development , in production.

i not doing fancy adding code completion:

my mailer code:

  def send_message    @message = message.new(message_params)    if @message.save      contactmailer.delay.contact_form(@message.id)    end  end 

my mailer:

  def contact_form(message_id)     message = message.where(id: message_id).first     @email = message.email     @message = message.text     mail(to: "myemail@gmail.com", subject: "message contact form")   end 

and configuration production (which works without sidekiq):

  config.action_mailer.delivery_method = :smtp   actionmailer::base.smtp_settings = {     :address              => "smtp.gmail.com",     :port                 => 587,     :domain               => "gmail.com",     :authentication       => "plain",     :enable_starttls_auto => true,     :user_name            => "myusername",     :password             => "mypassword"   }   config.action_mailer.default_url_options = { :host => "mydomain.com" } 

and here typical sidekiq queue:

    /home/john/.rvm/gems/ruby-2.0.0-p247@cluey/bundler/gems/sidekiq-4ed6eba8aff1/lib/sidekiq/rails.rb:14: warning: toplevel constant queue referenced sidekiq::client::queue     2013-07-19t09:47:56z 20112 tid-1a5mkc info: booting sidekiq 2.5.2 redis @ redis://localhost:6379/0     2013-07-19t09:47:56z 20112 tid-1a5mkc info: running in ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]     2013-07-19t09:47:56z 20112 tid-1a5mkc info: see license , lgpl-3.0 licensing details.     2013-07-19t09:47:56z 20112 tid-1a5mkc info: starting processing, hit ctrl-c stop     2013-07-19t09:48:11z 20112 tid-1u2z02 devise::async::backend::sidekiq jid-4a7e66a14deab112191e4b49 info: start     2013-07-19t09:48:12z 20112 tid-1u2z02 devise::async::backend::sidekiq jid-4a7e66a14deab112191e4b49 info: done: 1.214 sec     2013-07-19t09:48:50z 20112 tid-1u2z02 devise::async::backend::sidekiq jid-32191822b789f5b6896a5353 info: start 2013-07-19t09:48:51z 20112 tid-1u2z02 devise::async::backend::sidekiq jid-32191822b789f5b6896a5353 info: done: 0.143 sec 2013-07-19t09:49:29z 20112 tid-1u2z02 sidekiq::extensions::delayedmailer jid-c1911e0c4b72295dc067d57f info: start 2013-07-19t09:49:29z 20112 tid-1u2z02 sidekiq::extensions::delayedmailer jid-c1911e0c4b72295dc067d57f info: done: 0.152 sec 

i think has actionmailer , sidekiq don't know how debug, seems work emails never delivered.

i found it, have run sidekiq this:

rails_env=production bundle exec sidekiq -d 

to run in production. it's same issue assets precompile.


Comments