Sefier Tang
Sefier Tang

Reputation: 790

Should I call deliver method when sending mail using rails?

In rails guide, I see the way to deliver email is calling like this:

UserMailer.welcome(@user).deliver

But in our codebase, I see code like this using sidekiq:

UserMailer.delay.welcome(@user)

And likely it works. I am wondering, should I call deliver to make the action happen or sidekiq does some magic here?

Upvotes: 0

Views: 80

Answers (1)

Airat Shigapov
Airat Shigapov

Reputation: 585

As you can see in Sidekiq's sources (click here) it calls deliver for you. Thats why you don't need to call it when you delay email.

Upvotes: 2

Related Questions