Jump to content

[SOLVED] header error when using mail function


phnxrecords

Recommended Posts

i have some simple php being used to send emails from my website straight to me that had been working 100% fine before i changed one little thing--i recently bought a second domain to be used on the same hosting account as my previous domain, and now i am getting header errors in my php when the Submit button is pressed. i DID read the header sticky but don't quite understand what i am doing wrong as i am NOT a programmer at all. i also read in many places that the error could be caused by blank spaces which i checked and didn't find any.

 

any help is appreciated, thank you so much.

 

the mail does send successfully when the form is submitted but instead of being sent to the confirmation page, the following error is displayed to the user:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/viz0/public_html/label/contact/email.php:1) in /home/viz0/public_html/label/contact/email.php on line 12

 

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$reason = $_POST['reason'];
$comments = $_POST['comments'];
$subject = "PHNX Records message from: $name <$email>";
$headers = "From: $name <$email>"; 
$message = "From: ". $name ." <". $email .">.\r\n\r\n";
$message .= "Regarding: ". $reason ."\r\n\r\n";
$message .= "Comments: ". $comments ."\r\n";
mail("<omitted>",$subject,$message,$headers);
header("Location: http://www.phnxrecords.com/contact/confirmation/");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.