Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mail and Lines should not be larger than 70 characters

Tags:

php

I can't understand this line from the official documentation of mail function in PHP:
http://php.net/manual/en/function.mail.php

Each line should be separated with a LF (\n). Lines should not be larger than 70 characters.

Even more, in their example they recommens to do something like this:

// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

Why is that? and what happens with URLs for example? they are frequently much larger than 70 characters
What are the problems we could have if we don't do it?

Thanks!

like image 242
Enrique Avatar asked Jan 29 '12 16:01

Enrique


1 Answers

There are several ways to overcome the 70 char limit, using quoted_printable_encode for instance, or familiar base64_encode. However, there are not that many clients left that cannot deal with long lines, although it is of course best to adhere to it if you are able.

like image 72
Wrikken Avatar answered Sep 20 '22 15:09

Wrikken