Q:

Why must email headers be separated by "\r\n"?

In the PHP manual here, it shows header lines ending in "\r\n" but it never explains why.
I have been googling this one, but most results explain why "\r\n" is more compatible than "\n", however this answer must be too advanced for me because I can't understand why headers need either.
I understand it is used to display things on a new line, but why should that matter for email headers?
What does the "\r\n" do (in the context of email headers)? Is there a situation where I may not want the "\r\n"? What do I risk by leaving out the "\r\n"? Is this a concept exclusive to the mail() function or is there an entire category of functions that requires "\r\n"?

A:

I understand it is used to display things on a new line, but why should that matter for email headers?

Its probably just the parsing strategy for the headers. After a CRLF, check for the next header...

What does the "\r\n" do (in the context of email headers)? 

As i said, parsing strategy..

Is there a situation where I may not want the "\r\n"? 

In PHP 7.2.0 you can pass an array instead of a string... but its probably just doing the processing for you.

What do I risk by leaving out the "\r\n"?

A non delivered email.

Is this a concept exclusive to the mail() function or is there an entire category of functions that requires "\r\n"?

Not that i remember... but in this case, i think it would be for parsing too.

