Jump to content

Mass mail problem


fja3omega

Recommended Posts

I'm currently trying to use this script to send email with different content to different emails.

The problem I am having is that once it reaches about 90 emails it suddenly stops.

I don't know if the problem is the bandwidth of the domain or the script itself.

Can someone help me with this please.

Thank you.

 

$result = mysql_query("SELECT * FROM table1");

while($row = mysql_fetch_array($result))

{

$email = $row['Email Address'];

$company = $row['Company'];

$cntperres = mysql_query("SELECT * FROM table2 WHERE `Email Address`='$email'");

while($cntperrow = mysql_fetch_array($cntperres))

{

$cntper = $cntperrow['Contact Person'];

}

# -=-=-=- MIME BOUNDARY

$mime_boundary = "----BEYOND SHIPPING----".md5(time());

# -=-=-=- MAIL HEADERS

$to = $email;

$subject = "MAIL for " . $company;

$headers = "From: [email protected]\n";

$headers .= "Reply-To: [email protected]\n";

$headers .= "CC: [email protected]\n";

$headers .= "MIME-Version: 1.0\n";

$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";

$message .= "--$mime_boundary\n";

$message .= "Content-Type: text/html; charset=UTF-8\n";

$message .= "Content-Transfer-Encoding: 8bit\n\n";

$message .= "<html>\n";

$message .="<p>Dear <strong>";

$message .= $cntper;

$message .="</strong>,</p>";

$message .= 'message1';

$result2 = mysql_query("SELECT * FROM `table1` WHERE `Email Address`='$email'");

while($row2 = mysql_fetch_array($result2))

{

$message .= "message2 selected from table1";

}

$message .= 'message3';

$message .= 'message4';

$message .= "<p></p>";

$message .= "</body>\n";

$message .= "</html>\n";

# -=-=-=- FINAL BOUNDARY

$message .= "--$mime_boundary--\n\n";

# -=-=-=- SEND MAIL

$mail_sent = @mail( $to, $subject, $message, $headers );

if($mail_sent)

{

echo "\nmail sent to " . $email;

}

else

{

echo "\nmail not sent to " . $email;

}

}

 

 

Any suggestions would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/202144-mass-mail-problem/
Share on other sites

Okay... its still not working... it still stops... must be the execution time set on my server...

have decided to split this into little bits... maybe split the emails by 50 email sending each run...

does anyone have a clue how to automatically open a new page or redirect the page to a different page after running this kind of script?

without clicking on a link or button...

thank you.

Link to comment
https://forums.phpfreaks.com/topic/202144-mass-mail-problem/#findComment-1061200
Share on other sites

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.