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/");
?>

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.