Jump to content

email


sstangle73

Recommended Posts

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>

Link to comment
Share on other sites

I have also have a problem with sending email using php.

Actually when i press the button for sending it will take too

much long time to send.

and it stops in between.

And get stuck

Any suggestion , help etc

Please help me ...................................

 

 

Link to comment
Share on other sites

 

 

add the comments tags around this code and telll me if the server is faster loool :D

comment tags like so

/* i am a comment balbla
$ex = explode(",",$to);

if(count($ex) > 0){
foreach($ex AS $emails){
$email = trim($emails);
mail($email,$subject,$message,$headers);
}
*/

 

 

 

The email might not work but it will defently b faster. If its faster then the problem is at foreach section coz you have not specified how many times it will loop and it goes n loops infinity number of times till a web browser such as internet explorer stops responding.

 

 

PS let me no if its faster then i help you re write that bit.

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.