Avatar of movieprodw
 asked on

Bounced email - Invalid new-line character sequence


I have an html form that send an email  to the client when someone fills out an inquery.

I just got this bounce response, do you know what it means and how to fix it?

Remote host said: 500 Invalid new-line character sequence

PHPApache Web ServerEmail Servers

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
Dave Baldwin

That's a very picky email server.  Header lines are supposed to be terminated by '\r\n' aka CRLF.  Seems most mail servers will accept just '\n' but not all I guess.

Well I just keep getting them and it is a little annoying, maybe it is my fault but I am just sending a contact inqury to a customer.

Here is the start of the email, can you please let me know if you see something obviously wrong.

$headers  = 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	$headers .= 'From: domain Online Inquiry <info@domain.com>' . "\r\n";
	$headers .= 'BCC: domain <info@domain.com>' . "\r\n";
	$headers .= 'Reply-to: '.$name.' <'.$email.'>' . "\r\n";
	$subject='domain Online Inquiry';

$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Open in new window

Dave Baldwin

What server OS are you on, what is the SMTP server, and what is the remote server?  Are you using the PHP mail() function?  Technically you're supposed to use MIME boundaries to send HTML email although a lot of servers don't require it.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

Yes I am using PHP mail(), I am calling it from a online form
Dave Baldwin

And the server OS and SMTP server?


I do not know if I am using an smtp it is a standard LAMP server
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dave Baldwin

Then SMTP is probably Sendmail or Postfix.  The SMTP server provided with IIS is picky about a few things.  Try sending a plain text email instead of HTML and see what happens.  Or I can post my PHP Email demo that you can try if you want.

I would love it if you had a html email demo!

Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

I was able to send an email from my computer to it no problem, I will try the phpmailer.
Your help has saved me hundreds of hours of internet surfing.

Thank you
Dave Baldwin

You're welcome, thanks for the points.