\r\n appearing in registration email from Joomla

flynny used Ask the Experts™
Hi all,

Basically when I register from my Joomla site the registration activation email being sent contains the \r\n instead of the newline?

The settings we are using are as follows;

    Mailer * SMTP
    From email admin@domain.co.uk
    From Name admin
    Sendmail Path /usr/sbin/sendmail
    SMTP Authentication Yes
    SMTP Security None
    SMTP Port * 587 (also tried 25)
    SMTP Username admin@domain.co.uk
    SMTP Password correct pass
    SMTP Host auth.smtp.1and1.co.uk

is there anything I can do to stop this?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Carriage return then line feed, CRLF, what you are seeing above, is apparently the expected end-of-line marker for most internet protocols,  so Joomla is behaving correctly.

Why is \r\n a problem for you?


sorry i understand what these symbols are. It is just when an email is received they are appearing a \r\n instead of the CRLF.

In that case it is down to your Email client not interpreting the characters correctly.  What client are you using?
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.


outlook all other html emails etc are coming through ok?

I would have thought it would interpret this??

Hmm.  Does this link help at all?



Thanks for the link.

I've tried pulling the fix out and adding it to the /languages/phpmailer/stmp.php i.e.

	$CRLF = wordwrap($CRLF, 70); // Just to be safe that SMTP-send works
	$CRLF = str_replace('\r\n', "\r\n", $CRLF); // Replace Windows breaks (rn)

Open in new window

to the __construct() method but this has changed anything.

As the link is for the cb_builder plugin I am not sure what else to change? (I assume this is the right file :) )

I am at a loss now, I am afraid.  I suggest you request additional attention using the "Request Attention" link above.

Sorry I can't help any more.

Just a thought, but did you change the email to send as HTML? If so, replace the /r/n with <br/>
Most Valuable Expert 2011
Top Expert 2016

Maybe the \r\n are enclosed in single quotes?  If so, try changing them so they are enclosed in double quotes like " instead of '
AndyAinscowFreelance programmer / Consultant

I'm puzzled.  Exactly what is the problem?
In the question you state you have \r\n rather than a newline.  Later you say you don't see the CRLF.

I'm probably repeating bits of earlier comments here:

\n is a newline (also called line feed)
\r\n is a carriage return and new line pair of characters
CRLF is a shorthand for Carriage Return Line Feed which is \r\n
In code one might have a mcaro called CRLF which expands to \r\n - on viewing a string the \r\n does NOT get printed out as CRLF
Switch from SMTP to phpmail and report back?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial