View Full Version : mailing list

04-20-2004, 11:10 AM
So I am in a band, and I would like to setup a form so that people can add themselves to a mailling list so that I can send them an email to prior to show. I want it to added on to a pre-existing list, and ideally check the list for the same email address before it adds. I can do this this in C++, however I have no idea where to start with HTML.

Any suggestions on where I can attain this information?

04-20-2004, 11:55 AM
This is going to need a server side language, such as php.
I'd PM a moderator and ask them to move this to one of the servr-side forums, depending on what languages are supported by your host.
<plug type="very shameless">A musician eh? you might like it here... (http://yourmusicforums.com/)</plug>

04-23-2004, 01:17 AM
Does anybody have at least some mailing list code that I can look at and maybe modified to fit? Or at least a site with some free coding?

04-23-2004, 01:27 AM
Well the first question I'll ask is what program are you using to send your emails? And so what format is your mailing list in currently? Is it merely a text file? or a database? or some XML document? Also, what OS are you running? And how would you go about it with C++?

Once you get us that information, then we can proceed to give you a hand.

Moscow, ID == Moscow, Idaho?? Heard of Moscow, Russia, but... that's kinda cool.


04-23-2004, 01:33 AM
Well I did a little digging and came up with these links:

Hope that helps,

04-23-2004, 01:35 AM
There are not going to very many people on list (I am talking like a max of 25 and that won't be for awhile), so I just plan on using outlook express. I am just going to grab the list off the server and copy the addresses in.

I am just going to have a simple text file saying, "we have a show....blah, blah, blah"

I am using Windows XP pro.

Short of writing the code I would just get the inputted email address, open the file, check for a duplicate, if no duplicate is found, place at the bottom of the list. close the file.

04-23-2004, 01:38 AM
Well, crap. What did you search for? I wasn't haven't a lot of luck, but I also didn't really no what language it would be for sure (other than this got moved to the PHP forum).

04-23-2004, 01:59 AM
Ok, so you want to do this in PHP? First of all, as it seems like this thread was moved here, do you have PHP installed on your server? Because for any of this to work, that's the first step.

Once you've got that sorted out, we can do the following:
Ok, so you've got a form on your website written in HTML? I'm assuming it just has a textbox (for the email address) and a submit button. The name attribute of your textbox is important as it will be the variable you'll use to reference the email address. Your form method should be set to POST, and your action should be set to your PHP file (ie. addToMailingList.php or something like that..).

So now, pushing submit will send the email address to your PHP page for processing. Ok so now in your PHP file you need to open your text file, read it line by line and ensure the email address doesn't exist. If it doesn't exist you append it to the end of the file.

Here's how:

$file_name = "mailing_list.txt";
$var_name = "email_address";

if (!($fp = fopen($file_name, "a+")))
exit("Unable to open the input file.");

while (!feof($fp)) {
$buffer = fgets($fp, 1024);
if($_POST[$var_name] == $buffer)
exit("Email address already exists.");

fwrite($fp, $_POST[$var_name]);

I'm pretty sure that'll work. So change $file_name and $var_name accordingly and hopefully that works out for you.