sstangle73 Posted January 30, 2008 Share Posted January 30, 2008 my script is sooooo slow anyone know a way to optimize it? <?php error_reporting(E_ALL); if(isset($_POST['sendemail'])){ $pass = $_POST['password']; if($pass == 'Shenentaha'){ $to = $_POST['emailto']; $subject = stripslashes($_POST['subject']); $amessage = nl2br($_POST['emailbody']); $message = stripslashes($amessage); $from = $_POST['from']; $reply = $_POST['reply']; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $from . "\r\n"; $headers .= 'Reply-to: ' . $reply . "\r\n"; $ex = explode(",",$to); if(count($ex) > 0){ foreach($ex AS $emails){ $email = trim($emails); mail($email,$subject,$message,$headers); } }else { mail($email,$subject,$message,$headers); } echo "Success<br><br><br><hr><br><br><br>New Email:"; } else { echo "Wrong Password. Contact Steven"; } } ?> <form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post"> <table> <tr><td> <textarea name="emailto" rows="15" cols="50">email@domain.com, email@domain.com, email@domain.com</textarea> </td></tr> <tr><td> <input type="text" name="subject" size="67" maxlength="100" value="subject"> </td></tr> <tr><td> <textarea name="emailbody" rows="15" cols="50">Message Here</textarea> </td></tr> <tr><td> <input type="text" name="from" maxlength="100" size="67" value="From Name: Name <email@domain.com>"> </td></tr> <tr><td> <input type="text" name="reply" maxlength="100" size="67" value="Reply To: email@domain.com"> </td></tr> <tr><td>Enter Password:</td></tr><tr><td> <input type="text" name="password" maxlength="50" size="67" value="Password"> </td></tr> <tr><td> <input type="submit" name="sendemail" value="Send!"> </td></tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/88627-email-script/ Share on other sites More sharing options...
cooldude832 Posted January 30, 2008 Share Posted January 30, 2008 how many ppl are you emailing. Also if the message is constant why not BCC them? Quote Link to comment https://forums.phpfreaks.com/topic/88627-email-script/#findComment-453817 Share on other sites More sharing options...
sstangle73 Posted January 30, 2008 Author Share Posted January 30, 2008 it goes slow with anything over 1 but like 200 for example would take 2 mins. because some people dont open stuff unless it is to them. and b4 anyone says this NO ITS NOT the server Quote Link to comment https://forums.phpfreaks.com/topic/88627-email-script/#findComment-453823 Share on other sites More sharing options...
cooldude832 Posted January 30, 2008 Share Posted January 30, 2008 honestly it can be your server, most servers that allow you to send mail run a check everytime you send a message, thus sending a bunch will cause it Have you tried BCCing mulitple users its a lot simpler and faster Quote Link to comment https://forums.phpfreaks.com/topic/88627-email-script/#findComment-453826 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.