zendframework / zend-mail

Mail component from Zend Framework
BSD 3-Clause "New" or "Revised" License
96 stars 111 forks source link

Windows 10/PHP7 Lone CR/LF Exception #115

Open tomshaw opened 8 years ago

tomshaw commented 8 years ago

On my windows 10/PHP 7 box I'm getting this error. This error does not effect our dev/production unix servers.

Unable to send mail: mail(): SMTP server response: 550 5.6.0 Lone CR or LF in headers (see RFC2822 section 2.2)

I don't think there is anything wrong with the code that is simply rendering a template.

$viewRenderer = $this->getServiceLocator()->get('ViewRenderer');

$content = $viewRenderer->render($template, $data);

$html = new MimePart($content);
$html->type = Mime::TYPE_HTML;
$html->charset = 'utf-8';
$html->encoding = Mime::ENCODING_8BIT;

$body = new MimeMessage();
$body->setParts([$html]);

$message = new Message();
$message->setSubject($data['subject']);
$message->setBody($body);
$message->setTo($data['to']);
$message->setFrom($config['noreply']['email'], $config['noreply']['name']);
$message->setEncoding('UTF-8');

$transport = new Sendmail();

$transport->send($message);
tomshaw commented 8 years ago

Just tested PHP 5.6 same machine works fine. Looks like this is solely PHP 7 issue.

michalbundyra commented 4 years ago

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/48.