Jump to content

PHP Email send and sometimes it does not send


canditer

Recommended Posts

I am really frustrated here, i have been working with the same email code(HTML Form submits fields to email) for awhile now and it has never given me a problem like this. what happens is the emails are sent but sometimes they are not sent. It is like there is a problem at the sever maybe, maybe thge sever switches on and off at times while people are filling in the form. The other scary part is that there are actually two email that are sent, one to the user and the other to the project manager for that form. So when a test was being conducted the user got the confirmation email but the project manager did not get the email. what could cos this?

 

Here is the code

 

<?php 
function customError($errno, $errstr,$error_file,$error_line,$error_context)
  {
  echo "<b>Error:</b> [$errno] $errstr on line $error_line<br />";
  die();
  } 
  set_error_handler("customError"); 
  
$Email2 = $_POST["Email"];


$to = "manager@domain.com" ;
$to2 = $Email2;
$from = "mail@domain.com";
$headers = "From: $from" . "\r\n" . 
$subject = "2012 Registration"; 
$body = "";
$body2 = "Thank you for your registration."."\r\n"."
Your invoice will be send to you within 48hours."."\r\n";


while (list($key,$value) = each($_POST)){
	$body .= sprintf("%s: %s\r\n",$key,$value); 
}
$send = mail($to, $subject, $body, $headers);
$send2 = mail($to2, $subject, $body2, $headers); 

  if(!$send)
{print "We encountered an error sending your mail, please notify webmaster@domain.com";}
?> 

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.