Jump to content

Quick question about mail()


ded

Recommended Posts

I have a database file with about 10k email addresses.  Is it good to have a php program to scan through the database 1 record at a time and do the mail() for each record?  Is there a better way to do this?

 

Regards,

DED

no.. that would be same as BOMB MAIL if you do that..

but if the reason are reasonable.. that's perhaps do

Hi,

 

Don't you think scanning the db for each record will increase the overhead. Rather you should query the db only once, then use a loop through the result set array for sending out the mail. like, if you are using mySQL then:

 

.
.
.
$query = "SELECT firstname, lastname, address FROM mailing_list;";

//execute the query once, $result is an array
$result = mysql_query($query, $link);

//Loop for the results
while ($row = mysql_fetch_assoc($result))
{
    // Prepare the message here
    $msg = "Dear ".$row['firstname'] . $row['lastname'];
    $msg. = "More stuff here";
    mail($row['address'], 'My Subject', $msg);
}

 

You could use sleep() to create a pause inbetween each email sent.  The only problem is that the timing would be the same, and some isp's see this as spamming.

 

I'm not sure how the hosting would react to 10k emails being sent by one person.  I have mailing list capabilities on my hosting, but it's limited to 1,500 per list.

 

my 2c worth.

Hi,

 

When I was using this approach to mail, I did two things to overcome the SPAM issue...

 

make the pause interval variable

.
$count = ($count + 1) % 10;
sleep( $count * $interval);
.

 

 

and the second thing was, to change the "From" address, message body & Subject line along with the sleep interval.

 

We can just add some dot(.)s or any char at the end of these strings.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.