RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.

Home Page:http://railsapps.github.io/rails-stripe-membership-saas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to send a email for a new subscription ?

ycourse opened this issue · comments

Hello,

How to send a email for a new subscription ?

Thx.

There are several possibilities. I recommend subscribing the new user to a MailChimp list and sending them a welcome email as a MailChimp action. See my book ‘Learn Ruby on Rails’ for how o subscribe a user to a MailChimp list.

Alternatively, you can send an email directly from the application. Look at app/models/user.rb and see how the expire method sends an email:

  def expire
    UserMailer.expire_email(self).deliver
    destroy
  end

You could add a method like this, to send an email when a new user is created:

  before_save :send_welcome

  def send_welcome
    UserMailer.welcome_email(self).deliver
  end

Thank You Daniel.