Page 1 of 1

From to mail w/ newsletter opt-in

Posted: Fri Jul 03, 2009 10:37 am
by spliceMedia
Here's what I'm trying to accomplish:

I need to be process standard web forms and have them sent to a recipient email address exactly how generic form-to-mail programs handle this. I also need an option where the person submitting the form can opt-in to our mailing list/newsletter.

Here's how I was thinking to accomplish this:
(note: I'm not an advanced programmer, just enough to be dangerous. I use pre-existing scripts and then modify them to accomplish what I need.)

By using an existing form to mail script and adding the proper code to it to tell it to open up the text file and/or database in order to append the email address to the list. This text file and/or database would be one that is used by an existing newsletter script which would facilitate the sending of the newsletter.

So in theory, I would be able to install an existing newsletter/mailing list program and would not have to modify it. I would just simply tell the program handling the form to mail to open the proper file/database and append the email address from the submitted form to that file/database. From there, I would be able to use the newsletter program to send the mail to all the users who have indicated they would like to join the list.

Does this seem like it would work? I would obviously have a check-box for the user to indicate they would like to be added to the mailing list. In this case, would I simply use an if/else if statement in the program saying if box is checked, add to mailing list, otherwise don't? Is there a better way to handle this or possibly a pre-existing program already designed to handle this that I don't know about?

Thanks for the help.

Re: From to mail w/ newsletter opt-in

Posted: Fri Jul 03, 2009 11:45 am
by Eric!
If you have an existing user/login base the you should add a field in the database table to indicate if they want to receive newsletters. There needs to be a config page somewhere so they can opt out in the future as well. Or some method to get off the list.

The form just needs a checkbox field for the letter as you described. Then the user info is stored along with the newsletter choice.

I'm like a broken record on the forum, but here it goes. The php mail code you modify needs to filter for email injection attacks and your database fields need to be filtered for SQL injection attacks too.