-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zend_Mail : html emails are not correct in php8.1 #274
Comments
Please provide a code snippet to reproduce it |
Hi, see snippet in attachment and result in image |
Look like problem come from your mail reader client, Here it's result i test with mail server MailTrap, Run you code in php 8.1
<?php
$path = [
__DIR__ . "/library",
get_include_path()
];
set_include_path(implode(PATH_SEPARATOR, $path));
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
$html = '<!DOCTYPE html>
<html>
<body>
<h1>TEST MESSAGE</h1>
<table width="100%" border="0" align="center" valign="top" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td align="center" valign="top"><table width="650" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
</tr>
<tr>
<td><br>
<br></td>
</tr>
<tr>
<td align="center" valign="top"><img src="https://www.d-nailbar.be/OG_d-nailbar.jpg" height="150" alt="ALT Omschrijving"/></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td style="background-color: #64254f;" class="title">this is a title</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</body>
</html>';
$tr = new Zend_Mail_Transport_Smtp('smtp.mailtrap.io', [
'auth' => 'login',
'username' => 'xxx',
'password' => 'yyy',
'port' => 465
]);
Zend_Mail::setDefaultTransport($tr);
$emailFrom = "[email protected]";
$emailTo = "[email protected]";
$mail = new Zend_Mail('UTF-8');
$mail->setBodyHtml($html);
$mail->setFrom($emailFrom, 'stijn');
$mail->addTo($emailTo);
$mail->setSubject('TEST koekoek');
$mail->send(); |
well, this is most strange, because when i run this script in php7.4, it works fine. |
So which smtp server do you use Mr @svansteenkiste ? |
i'm using Zend/Mail/Transport/Sendmail.php |
Oops look like internal bug of php 8.x. zf1-future/library/Zend/Mail/Transport/Sendmail.php Lines 102 to 107 in bc1be9c
Reference: |
i modified this on line 106: str_replace("\n", "\r\n", $this->header); Mail is now ok ! |
Thx for pointing me the right direction ;-) |
You’re welcome |
@svansteenkiste It's the Zend\Mail\Transport\Abstract and
Just in case you didn't found the exact problem yet. |
@jakubprokopec indeed, but in Zend\Mail\Transport\Sendmail you also have this maybe better to remove here? |
@svansteenkiste Totally... Thank you! |
FYI we have found that this issue may cause AWS Simple Email Service (SES) to reject mail with the message: "554 Transaction failed: Nested group". Just commenting this in the hopes that someone stumbles upon this when trying to Google it, because that particular error message is not easy to Google. |
From what I can see, those who faced this issue chose to make individual changes in the ZF1-Future file. May I ask why a PR was not pushed to fixe the issue for the others who have not faced it yet? In a test configuration I managed to reproduce this problem with all the email messages sent by OpenMage. |
Scheduled for 1.23.0 release, awaiting 2 more PRs resp. PR owners to take some action. |
1.23.0 released |
When trying to send html email in php7.4, everything works fine, but when changing to php8.1, html is shown as plain text instead of well formatted html email
The text was updated successfully, but these errors were encountered: