Ask A Question

Notifications

You’re not receiving notifications from this thread.

Sidekiq + Action Mailer

Michael Kogan asked in Rails

I study Ruby on Rails and I have a one-page simple application that will send emails to people. In the form on the page, a person enters the time and date when he wants to send an email.
deliver_now works for me but when I want to send it by deliver_later in 2 minutes for example (not yet by date) it doesn't. There is a link to the code.
https://paste2.org/X755DDUj

Reply

Hey Michael..Sidekiq allows you to schedule the time when a job will be executed, and so does Active Job, through deliver_later (https://edgeapi.rubyonrails.org/classes/ActionMailer/MessageDelivery.html#method-i-deliver_later). Active Job is integrated with Action Mailer, so try to enqueue the delayed delivery through Active Job instead of Sidekiq.

Update:
UsersWorker.perform_async(@user)

UsersMailer.remind_email(@user).deliver_later(wait: 2.minutes)

Reply

Thanks for the answer ! Now it works. Now I want to send it by users date and time and it doesn't send. It also doesn't save the date to db.
https://paste2.org/eVc4sL5k

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.