Skip to content
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

Upgrade Net_SMTP Package and remove now unneded patches and mov… #16498

Merged
merged 2 commits into from
Feb 16, 2020

Conversation

seamuslee001
Copy link
Contributor

…e to using composer patches rather than patching in a script file

Overview

This upgrades our version of the Net SMTP package, reviewing the code base some of the patches have now been incorporated into the library

Before

Patches happening within a script file and an outdated version of the library used

After

Latest version of the library used and patches more standardised

ping @totten @mfb @demeritcowboy

@civibot
Copy link

civibot bot commented Feb 8, 2020

(Standard links)

@civibot civibot bot added the master label Feb 8, 2020
@demeritcowboy
Copy link
Contributor

Just commenting the title probably shouldn't be [REF], since it looks like there's other changes between 1.6 and 1.9 than just these patches. I haven't looked too closely but just browsing pear/Net_SMTP@1.6.x...master

@seamuslee001 seamuslee001 changed the title [REF] Upgrade Net_SMTP Package and remove now unneded patches and mov… Upgrade Net_SMTP Package and remove now unneded patches and mov… Feb 9, 2020
@seamuslee001
Copy link
Contributor Author

Jenkins retest this please

@demeritcowboy
Copy link
Contributor

demeritcowboy commented Feb 16, 2020

Did some testing. A couple notes:

  • They've changed their license to BSD-2, but it makes it more permissive so that seems fine.
  • In net-smtp-patch.patch, note they've changed all underscore variables everywhere for some reason, so it needs to be $this->code in line 10 not $this->_code otherwise you get an E_NOTICE and a blank code.
  • For XOAUTH2, one of the things that will need to be taken into account on the civi side is that they don't automatically include the word Bearer - see https://github.com/pear/Net_SMTP/blob/1.9.0/Net/SMTP.php#L982, so civi will need to prepend that to the token before sending to the library. Unfortunately that may or may not be specific to gmail. The fact that they've left it out suggests it is specific to gmail. So this is a bit inconsistent with the changes in zetacomponents which always includes the word Bearer.
    • But once I made that change and obtained a token manually and then also hacked SMTP.php to always select XOAUTH2, I was able to use that token and create an email in civi and send thru gmail using oauth2.
  • I was also able to create and send an email in civi using a regular non-gmail account in the smtp settings as normal.

…e to using composer patches rather than patching in a script file
@seamuslee001
Copy link
Contributor Author

thanks @demeritcowboy i believe i have fixed that e-notice error thing, given i am just focusing on the package upgrade here i think we can ignore the oauth2 stuff for the moment

@eileenmcnaughton
Copy link
Contributor

From talking to @seamuslee001 it seems like oath would be a new feature so non blocking - MOP as review has not thrown up other things

@demeritcowboy
Copy link
Contributor

demeritcowboy commented Feb 16, 2020

It looks like the whole patch file was deleted. Did you not want to keep the custom error which seemed helpful?

@seamuslee001
Copy link
Contributor Author

@demeritcowboy the patch is still in place its just referenced in a specific commit now see https://raw.githubusercontent.com/civicrm/civicrm-core/a6a0ff13d2a155ad962529595dceaef728116f96/tools/scripts/composer/patches/net-smtp-patch.patch this is so that it can work for D8 purposes as well (when civicrm-core is not in the root)

@demeritcowboy
Copy link
Contributor

Ok I'm not following but if you're good then ok. When I look on the files changed tab the net result seems to be the patch is now missing.

@seamuslee001 seamuslee001 merged commit 2410caa into civicrm:master Feb 16, 2020
@seamuslee001 seamuslee001 deleted the net_smtp_upgrade branch February 16, 2020 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants