Skip to content

Replaced Zend_Mail_Transport_Sendmail with Laminas\Mail\Transport\Sendmail #3191

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

Closed
wants to merge 1 commit into from
Closed

Conversation

fballiano
Copy link

@fballiano fballiano commented Apr 18, 2023

After #3174 () I thought that maybe Zend_mail would be a good candidate for a replacement with a more modern implementation so I made a test.

  • this PR only replaces Zend_Mail_Transport_Sendmail with its Laminas counterpart
  • this PR does not replace the entire Zend_Mail (at the moment, let's see what the reception of this code and decide what to do next)
  • I've tested the email sending and it works correctly
  • I've also tested installing aschroder/smtp_pro to see if this change was breaking it but it seems not to break it
  • I've targeted this PR to main since it doesn't seem at the moment to be breaking anything, maybe it should be considered BC and targeted to next?

How to test? be sure to be using sendmail on your server, install the PR, composer install, try to send a "forgot password" email

What do you think about this idea?

@github-actions github-actions bot added Component: Core Relates to Mage_Core composer Relates to composer.json labels Apr 18, 2023
@addison74
Copy link
Contributor

addison74 commented Apr 18, 2023

On the one hand, looking at the code Laminas-Mail is far more complete than ZF1-Future. The PR that you proposed today in their repository has no chance of being approved soon. In addition it should be completed with what exists in Laminas-Mail to be sure that we cover all situations, at least in the case of Windows OS's there will be issues.

On the other hand, we outsourced the Zend 1 framework, which created this issue for us in relation to the new PHP versions. Either we create a custom version as it was until we removed the framework from OpenMage repository or we find another temporary or definitive solution. At this moment Laminas-Mail solves the issue regarding the format of received emails, it is a maintained project. Who knows maybe in time we will adopt other parts of Laminas.

EDIT: It is fine to be targeted in main branch. The reported issue with the new PHP 8.x versions is a serious one, not seeing the content of the messages is really a big problem, because it concerns the direct relationship between the online store and its visitor

@fballiano
Copy link
Author

exactly, from what I've seen zf1future is not super quick in fixing problems (it's probably also a good thing to be careful, for sure) which could be a bit of a problem. it is also used by a limited amount of people compared to laminas or symfony.

and thanks to composer we're facilitated in adding different vendors, if needed.

laminas is mostly compatible with zend framework, there are still many differences, but in this case the syntax was the same.

I think that, without the zf1future step (which we will require for long time anyway), we wouldn't be able to do something like this specific PR.

So let's see :-)

@fballiano
Copy link
Author

I've done some more work trying to rewrite the whole Zend_Mail dependency but... I don't know... the whole paradigm has changed and you've to call a $transport->send() instead of $mail->send($transport) and to send a text/html email you've to do https://docs.laminas.dev/laminas-mail/message/attachments/

So, I don't know, is it worth the risk? Or better stick with the zf1f implementation and maybe add a new "zf1f patch" to our composer for the moment?

@addison74
Copy link
Contributor

Maybe we should "force" the change in ZF1-Future. If they don't want to accept it, a patch can be implemented as @sreichel did with other changes. We take the parts we need from Laminas-Mail and implement them to solve the issue.

I haven't checked, but what we were using before ZF1-Future would have created trobule with PHP 8.x?

@fballiano
Copy link
Author

I haven't checked, but what we were using before ZF1-Future would have created trobule with PHP 8.x?

No idea actually, i can imagine it would have

@luigifab
Copy link
Contributor

I dislike because this adds a new dependency.
To fix the problem, we can also add a composer-patches.

@addison74
Copy link
Contributor

If ZF1-Future is no longer maintained, we will bring it in back here and we have to make the necessary changes. at least to keep it compatible with future PHP versions. In this case Laminas-Mail is no longer a solution, @fballiano proceeded well to create a PR in ZF1 repository. Please test and approve it if you encounter no issues.

@fballiano
Copy link
Author

it was an interesting chat to have anyway :-)

@fballiano fballiano closed this Apr 19, 2023
@addison74
Copy link
Contributor

Indeed we discovered Laminas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Relates to Mage_Core composer Relates to composer.json Don't forget this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants