RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.
http://railsapps.github.io/rails-stripe-membership-saas
1.14k stars 232 forks source link

How to send a email for a new subscription ? #103

Closed ycourse closed 10 years ago

ycourse commented 10 years ago

Hello,

How to send a email for a new subscription ?

Thx.

DanielKehoe commented 10 years ago

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
ycourse commented 10 years ago

Thank You Daniel.