# Sending 2 different e-mail verification

**URL:** <https://www.ruby-forum.com/t/sending-2-different-e-mail-verification/179568>\
**Category:** Rails\
**Created:** [November 28, 2009, 8:30pm UTC](https://www.ruby-forum.com/t/sending-2-different-e-mail-verification/179568 "2009-11-28T20:30:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugues](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@hugues](https://www.ruby-forum.com/u/hugues)\
**Post date:** [November 28, 2009, 8:30pm UTC](https://www.ruby-forum.com/t/sending-2-different-e-mail-verification/179568/1 "2009-11-28T20:30:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hugues](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@hugues](https://www.ruby-forum.com/u/hugues)\
**Post date:** [November 29, 2009, 6:40pm UTC](https://www.ruby-forum.com/t/sending-2-different-e-mail-verification/179568/2 "2009-11-29T18:40:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hugues](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@hugues](https://www.ruby-forum.com/u/hugues)\
**Post date:** [November 29, 2009, 9:30pm UTC](https://www.ruby-forum.com/t/sending-2-different-e-mail-verification/179568/3 "2009-11-29T21:30:00Z")

</div>

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

Hugues
