# Email/subscriber validation issues with subscriber\_lists extension

**URL:** <https://www.ruby-forum.com/t/email-subscriber-validation-issues-with-subscriber-lists-extension/150547>\
**Category:** Radiant CMS\
**Created:** [October 9, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/email-subscriber-validation-issues-with-subscriber-lists-extension/150547 "2008-10-09T19:25:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 9, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/email-subscriber-validation-issues-with-subscriber-lists-extension/150547/1 "2008-10-09T19:25:08Z")

</div>

Hey guys,

I am using the subscriber lists extension (thanks nelstrom, I love the  
CSV  
export) for creating a “contact us” type of form. The problem is that  
when  
somebody signs up with an email address that is already in the db, the  
information gets overwritten with the newly submitted data. I am not  
exactly  
sure how to add a check against the db to find out if an email address  
is  
already there, and then return an error message that tells the user so.  
Can  
anybody give me some pointers on how to add that into the form process  
action?

Pastie with the action from the subscriber\_list\_page model:  
[http://pastie.org/288758](http://pastie.org/288758)

Mucho, mucho garcias.

~Nate

---

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 9, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/email-subscriber-validation-issues-with-subscriber-lists-extension/150547/2 "2008-10-09T23:55:07Z")

</div>

On 9 Oct 2008, at 18:24, Nate T. wrote:

> Hey guys,
> 
> I am using the subscriber lists extension (thanks nelstrom, I love  
> the CSV  
> export) for creating a “contact us” type of form.

I’m not sure if I understand you correctly, but “Contact us” is not  
the use case I had in mind when I made the subscriber lists extension.  
It is more appropriate for a “Sign up to our mailing list” type of  
scenario. (Such as demonstrated here: [http://westportbookfestival.org/](http://westportbookfestival.org/))

If you want a “Contact us” form, I think the Mailer extension could be  
a better fit.

[GitHub - radiant/radiant-mailer-extension: An extension for Radiant CMS that allows you to create 'contact us' and other mail-bound forms.](http://github.com/radiant/radiant-mailer-extension/tree/master)

I’ll answer the rest of your mail assuming that a “Sign up to our  
mailing list” scenario is what you actually want…

The subscriber\_list extension does not handle sending mail from the  
server, so there is no verification step. (e.g. sending an email to  
the submitted address, with an activation link.) If you need that  
functionality, try out Andrea’s newsletter extension:

[GitHub - gravityblast/radiant-newsletter: Newsletter system based on Radiant CMS](http://github.com/pilu/radiant-newsletter/tree/master)

The subscriber list extension is basically a plagiarized newsletter  
extension, with the mailing functionality removed. I couldn’t get the  
newsletter extension to send mail through a gmail account. Although I  
would be willing to try again since I discovered this:

[http://github.com/caritos/action\_mailer\_tls/tree/master](http://github.com/caritos/action_mailer_tls/tree/master)

> The problem is that when somebody signs up with an email address  
> that is already in the db, the information gets overwritten with the  
> newly submitted data.

If an email is submitted to the form, it is added to the list  
immediately. Without verifying that the email address submitted  
belongs to the person who submitted it,

Without a verification step, the case of one email being submitted  
more than once is difficult. You could either:

- Add all details to the db each time they are submitted, regardless  
of whether they have been submitted before or not (potentially leading  
to duplicates)
- Check if an email has been added already, and ignore any form  
submissions if the email address supplied is already in the db
- Check if an email is already in the db, and if it is, use the  
details supplied in the form to update the details of the entry  
already existing

I settled for the last of these, although none of them are really  
satisfactory, because you don’t know (without a verification step)  
whether the person submitting the form is the true owner of the email  
address.

Verification is clearly the best-practice, but as an extra step in the  
procedure, it can be seen as a deterent. And so clients often prefer  
to have a simple one-step signup, despite the problems it can cause.

> I am not exactly sure how to add a check against the db to find out  
> if an email address is  
> already there,

It already does this (line 9 in your pastie):

@subscriber =  
Subscriber.find\_by\_email\_and\_subscriber\_list\_id(parameters[:email],  
self.id)

Here is the relevant section of code, annotated with comments:

[http://pastie.org/289009](http://pastie.org/289009)

That should help you out, if you want to modify the behaviour.

Cheers,  
Drew
