Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

echo before mail function take 10 sec to display

the mail() function

Moderators: macek, egami, gesf

echo before mail function take 10 sec to display

Postby ronaldmon » Mon May 12, 2014 10:31 pm

<?php

if (isset($_POST['submit'])){
$name = trim(stripslashes(htmlspecialchars($_POST['name'])));
$email = trim(stripslashes(htmlspecialchars($_POST['email'])));
$message = trim(stripslashes(htmlspecialchars($_POST['message'])));
$mailTo = "rmontagna1@att.net";
$msgSubject = "Requesting Information ";
$msgBody = "From: $name,\n\r Email: $email,\n\r Message:\n\r$message";
/*$xHeaders = "From: $email X-Mailer: PHP/". phpversion(); */
$xHeaders = "From: $email" . phpversion();
if ($_POST['name'] == "" || $_POST['email'] == "" || $_POST['message'] == ""){
echo "You forgot to enter data in all the field<br>Please enter the data and then submit again";
exit;}

echo '<div style=\'margin-top: 10px; margin-left:2px; border: 5px groove blue; border=radius:5px; padding-left: 10px; width:400px;\'>
<p>Thanks By <a href="http://www.kyumartialarts.com">KYU Martial Art</a></p>
<hr style=\'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;\'/>
<h1>Thanks for Your Message! <br>Your message has been sent! </h1>
<p><a href="Default.html">Click to go to Home page!</a></p>
</div>';[/b]

mail($mailTo, $msgSubject, $msgBody, $xHeaders);
$mailTo = $email;
$msgSubject = "Thank You for your email.";
$msgBody = "Thank you for your email. I will respond to you as soon as possible.\n\r
Please feel free to contact me at (818)576-3550 you need immediate assitance.\n\r Our hours are Monday-Friday 3pm-7:45pm and Saturday 11am-2pm.\n\r
You are alway welcome to drop by during these hours to check out my classes.\n\r\n\r Thank You\n\r Master Lee";
$xHeaders = "From: rmontagna1@att.net". phpversion();
mail($mailTo, $msgSubject, $msgBody, $xHeaders);
echo '<script type="text/javascript">clearform()</script>';
}
?>


The echo statement
echo '<div style=\'margin-top: 10px; margin-left:2px; border: 5px groove blue; border=radius:5px; padding-left: 10px; width:400px;\'>
<p>Thanks By <a href="http://www.kyumartialarts.com">KYU Martial Art</a></p>
<hr style=\'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;\'/>
<h1>Thanks for Your Message! <br>Your message has been sent! </h1>
<p><a href="Default.html">Click to go to Home page!</a></p>
</div>';[/b]

before mail($mailTo, $msgSubject, $msgBody, $xHeaders); takes 10 seconds to display. I place a exit; at the end of the echo statement and it display right of way. I used ob_start and ob_flush nothing seem to work. It seem that the echo will not display until the mail function is complete. Any idea why the echo statement is being delay. Would like it to display immediately. Any help would be appreciated
ronaldmon
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon May 12, 2014 10:02 pm

Return to PHP coding => Mail

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.