--TEST-- Bug #80751 (Comma in recipient name breaks email delivery) --SKIPIF-- --INI-- SMTP=localhost smtp_port=25 --FILE-- \" <{$to}>"; $from = 'bug80751_from@example.com'; $fromLine = "\"\" <{$from}>"; $cc = $users[1]; $ccLine = "\"Lastname, Firstname\\\\\" <{$cc}>"; $bcc = $users[2]; $subject = 'mail_bug80751'; $message = 'hello'; $headers = "From: {$fromLine}\r\n" . "Cc: {$ccLine}\r\n" . "Bcc: \"Firstname \\\"Ni,ck\\\" Lastname\" <{$bcc}>\r\n"; $res = mail($toLine, $subject, $message, $headers); if ($res !== true) { die("Unable to send the email.\n"); } echo "Email sent.\n"; foreach (['to' => $to, 'cc' => $cc, 'bcc' => $bcc] as $recipient => $mailAddress) { $mailBox = MailBox::login($mailAddress); $mail = $mailBox->getMailsBySubject($subject); $mailBox->logout(); if ($mail->isAsExpected($fromLine, $toLine, $subject, $message)) { echo "Found the email. {$recipient} received.\n"; } if ($mail->getHeader('Return-Path') === $from) { echo "Return-Path is as expected.\n"; } if ($mail->getHeader('Cc') === $ccLine) { echo "Cc header is as expected.\n\n"; } } ?> --CLEAN-- deleteMailsBySubject($subject); $mailBox->logout(); } ?> --EXPECT-- Email sent. Found the email. to received. Return-Path is as expected. Cc header is as expected. Found the email. cc received. Return-Path is as expected. Cc header is as expected. Found the email. bcc received. Return-Path is as expected. Cc header is as expected.