Home Email My Account ☎ 480-624-2500

PHP mail function fails with "message has lines too long for transport"

September 13, 2022

Symptom: Bounce back message received when sending email using PHP mail. 

Cause: Email providers like Outlook will reject the message if the recipient does not have wordwrap enabled for HTML emails and the email contain lines longer than 65 characters.

Solution: Use the wordwrap function to wordwrap your message.

Example: $message = wordwrap($message, 70,"\r\n");