Setup a mailing list

Lugztaz

[H]ard|Gawd
Joined
Jun 21, 2004
Messages
1,783
I am looking for either a website or some code to setup a mailing list for a website that I have. I have collected all of the emails and names from registration but they sit in a database untouched at this time.

I will have very few emails going out but the suggestion of just making a distro list in outlook won't work because this mailing list may be used by one or two other people. What are the best solutions out there to get this done?
 
What I generally do is stick them all in a MySQL db and write a PHP script to process the content and perform the mailing task. Just make sure you use SMTP with authentication in your script instead of the generic mail() function to overcome some of the big vulnerabilities.
 
something like this
Code:
$conn = mysql_connect(....);
mysql_select_db(....);
$SQL = "SELECT email FROM sometable";//get emails from the DB
$rs = mysql_query($SQL,$conn);

$send_to = '';
while ($record = mysql_fetch_object($rs))
{
  $send_to .= $rec->email . ',';//create list of addresses (separate with commas!!)
}

//prepare the email
$headers = "From: somebody@somedomain.com";
$subject =  "Hi there, here's your spam";
$message = "This is my wonderful message";

//send the email
mail ($send_to, $subject,$message,$headers);
 
While that will work, the mail() function has a lot of vulnerabilities. You'd be better off with a script that authenticates with an SMTP account and sends email that way...

Same basic concept, I just wouldn't pick the easy way out...
 
While that will work, the mail() function has a lot of vulnerabilities. You'd be better off with a script that authenticates with an SMTP account and sends email that way...

Same basic concept, I just wouldn't pick the easy way out...

yeah, but couldn't you alleviate that by configuring your mail server to only relay from the IP address of your web server? I'm pretty sure that's how our mail server is configured where I work, I had to provide them with the IP address of my webserver before I could send out any mail from my script.
 
yeah, but couldn't you alleviate that by configuring your mail server to only relay from the IP address of your web server? I'm pretty sure that's how our mail server is configured where I work, I had to provide them with the IP address of my webserver before I could send out any mail from my script.

In a corporate environment or a webserver where you have access to do that, yes. Not sure what type of access the OP has on his server. If he's just on a shared cPanel account somewhere (or something similar) I'm not sure he'd be able to get that configured.
 
Back
Top