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: ME@ME.com\n";

$headers .= "Reply-To: ME@ME.com\n";

$headers .= "CC: ME2@ME2.com\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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.