BeckyKing Posted September 1, 2015 Share Posted September 1, 2015 Hi, I have created a form and up until Friday it was working correctly but now get the error: Warning: mail(): Multiple or malformed newlines found in additional_header in /home/westover/public_html/contact-form-submission.php on line 267 Warning: mail(): Multiple or malformed newlines found in additional_header in /home/westover/public_html/contact-form-submission.php on line 267Warning: mail(): Multiple or malformed newlines found in additional_header in /home/westover/public_html/contact-form-submission.php on line 267Warning: mail(): Multiple or malformed newlines found in additional_header in /home/westover/public_html/contact-form-submission.php on line 267Warning: Cannot modify header information - headers already sent by (output started at /home/westover/public_html/contact-form-submission.php:267) in /home/westover/public_html/contact-form-submission.php on line 247 // send the user back to the formLine 247: header('Location: index.php?s='.urlencode('Thank you for your message.')); exit;function mail_attachment($to, $subject, $message, $from, $data, $test2) { $content = chunk_split(base64_encode($data)); $uid = md5(uniqid(time())); $from = str_replace(array("r", "n"), '', $from); // to prevent email injection $header = "From: ".$from."rn" ."MIME-Version: 1.0rn" ."Content-Type: multipart/mixed; boundary="".$uid.""rnrn" ."This is a multi-part message in MIME format.rn" ."--".$uid."rn" ."Content-type:text/plain; charset=iso-8859-1rn" ."Content-Transfer-Encoding: 7bitrnrn" .$message."rnrn" ."--".$uid."rn" ."Content-Type: application/octet-stream; name="".$test2.""rn" ."Content-Transfer-Encoding: base64rn" ."Content-Disposition: attachment; filename="".$test2.""rnrn" .$content."rnrn" ."--".$uid."--"; Line 267: return mail($to, $subject, "", $header);}?> I have highlighted which lines the error is talking about. Any advice is welcome. Thank you in advance!! Link to comment Share on other sites More sharing options...
Ingolme Posted September 1, 2015 Share Posted September 1, 2015 I believe the malformed newline problem might be because it expects only one rn after each header rather than two. The "headers already sent" message shows up because the mail error message is considered output, and there cannot be output before you send headers. Link to comment Share on other sites More sharing options...
BeckyKing Posted September 1, 2015 Author Share Posted September 1, 2015 I ahve changed thye code so the headers only have one rn after it but still throws the Warning: mail(): Multiple or malformed newlines found in additional_header in /home/westover/public_html/contact-form-submission.php on line 267 but only one error this time. The "headers already sent" message shows up because the mail error message is considered output, and there cannot be output before you send headers What is my mail error message? Line 247? I have tried to put this at the end of the code but still gives an error? Thank you for your help. Link to comment Share on other sites More sharing options...
Ingolme Posted September 1, 2015 Share Posted September 1, 2015 The mail error message is this: Warning: mail(): Multiple or malformed newlines found in additional_header in /home/westover/public_html/contact-form-submission.php on line 267 but only one error this time. When that error is fixed, the headers error will go away too. What does your fixed code look like? There must still be something wrong with the new lines. Link to comment Share on other sites More sharing options...
BeckyKing Posted September 1, 2015 Author Share Posted September 1, 2015 i HAVE NOW MANAGED TO FIXED THE ISSUE. THANK YOU VERY MUCH FOR YOUR HELP!!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now