If ($success) Doesnt work properly

I’m trying to send customer e-mail and re-direct to a page once the form has been successfully submitted. The form send me e-mail but does not send the customer one and it does not re-direct to thank you page all it does goes to the same page.

// send email 

$success = mail($receiver, $Subject, $EmailBody, "From: $myname<$sender>\nReply-To: $sender\nContent-Type: text/html");

// redirect to success page 

if ($success){

		$EmailBody2 = "Thank you for submit your Delivery Request. Please allow 24 hours before we respond, if we don’t respond within 24 hours please contact us at 404-312-3610. If you have any immediate question or concerns please call us at 404-312-3610. We look forward to working with you.<br/><br/><img src='http://bigtdelivery.com/images/logo.jpg'/>";
		$success2 = mail($sender, $Subject, $EmailBody2, "From: BigTDelivery<info@bigtdelivery.com>\nReply-To: info@bigtdelivery.com\nContent-Type: text/html");

		if ($success2){
			 @header("location:".get_site_url()."/thank-you/");
		}else{
			 @header("location:".get_site_url()."/delivery-request/");
		}

}else{

  @header("location:".get_site_url()."/delivery-request/");

}

}

get_header(); ?>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.