phpemailsmtp

501 Syntax error - line too long


While sending mail through php I am getting below error-

501 Syntax error - line too long 
The following SMTP error was encountered: 501 Syntax error - line too long 
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

As above message clearly explains the issue but I don't want to reduce the content of html template. Any idea where I need to change settings ?

I am using these details-

'smtp_host' => 'smtp.1and1.com',
                'smtp_port' => '587',

Solution

  • Without seeing the template code itself, you likely need to break the content over several lines by adding in some newline characters.

    It's fairly easy to accidentally create very long lines, for example when you have a loop echoing out content, or appending content to a string. Check these situations first. New lines can be added by "\n" or PHP_EOL, and won't affect the formatting of your html.