Sending 2 different e-mail verification

Hello there,

I need to send two different e-mail verification to users that subscribe
to our website.

Basically there is 2 kind of subscriptions :

  • Beta Tester Program Sign Up
  • Newsletter

Two type of users within Users table (I use STI) :

  • BetaTester
  • Subscriber

I can perfectly make it works for one e-mail verification… the problem
is when I try to send two different.

I think it has to be within the UserObserver :

class UserObserver < ActiveRecord::Observer
def after_create(user)
UserNotifier.deliver_beta_tester_signup_notification_en(user)
UserNotifier.deliver_subscriber_signup_notification_en(user)
end
end

You can see that I am sending the two e-mail verification.

Is it possible to use conditions within this model so I can verify if
user.type = BetaTesters send this, else send that?

I use acts_as_authenticated on rails 1.2.6

Thx a lot for your time and help.

Hugues

Hi Hugues,

Is it possible to use conditions within this model so I can verify if
user.type = BetaTesters send this, else send that?

Yes you should, and if you dont want your user type to be saved in the
database

use something like

attr_accessible :type in your User model

when sending the e-mail check the type first and them send them
separately, But one thing to consider

what will happen if one of your Beta tester wants to subscribe for your
news letter

So there are 3 types

Beta testers (only)
Beta testers and Subscriber
Subscriber (only)

My personal preference would be

One e-mail for Beta Testers (only)

another e-mail for Beta testers and Subscriber (which should have both
the content - coz sending 2 mails for same user will rather annoying…)

another e-mail for Subscriber (only)

hope this helps

cheers,
sameera

Hi Sameera
Thanks. I’ll try as soon as possible and let you know the results.

Hugues