rank
rank

Reputation: 83

Sending list of emails to a user once they sign up in rails application

I need to send emails to the user who sign up on my system. So, for instance say a user sign up today then after 3 days they should receive one email. Then after 6 days he should receive another email and so forth. There are 8 emails with the interval of 3 days.

I need to run a task where every midnight or every 12 hrs and that task should check whether are there any user who created account in 3,6,9,etc days before. I am aware of Rufus-Scheduler and even it works fine but I am not sure it is good to use it as my production configuration is unicorn and ngninx.I am also using sidekiq in my application for devise async emails.

Is there any other way to implement this or what would be the best way to implement such a system. Thanks in advance for help

Upvotes: 0

Views: 76

Answers (2)

milind phirake
milind phirake

Reputation: 493

You can use reschedule method of sidekiq

Sidekiq::ScheduledSet.new.find_job().reschedule(1.day.from_now)

Upvotes: 1

Taryn East
Taryn East

Reputation: 27747

My best recommendation would be:

  1. sign up for an account on mailchimp
  2. add the relevant mailchimp gem to your app
  3. when a user signs up to your app, send an API request to mailchimp to subscribe the user
  4. on mailchimp, set up a campaign that has the emails for the user at the required frequency...
  5. don't forget to unsub the user from mailchimp if your user deletes their account on your app

Use mailchimp because you'll get better visibility on open/close rates and it will automatically deal with things like the user wanting to un-sub from your emails (which you are required by law to allow them to do). You also get better ability to do nice things with filtering the list of users eg sending a special email to users that have not yet seen the X email or who opened every email...

Upvotes: 1

Related Questions