How to send emails later in Rails 5

If you want to schedule an email to send after a certain period of time in Rails 5 – for instance, to send a welcome email the day after a user has created their account – you can use ActionMailer’s deliver_later method and add a wait_until parameter.

def create
# ...

UserMailer.welcome.deliver_later(wait_until: 1.day.from_now)

# ...
end

There are a number of things you can do with this. Some ideas:

Don’t abuse this too much – only send email that’s truly important.