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

chore: migrate to symfony/mailer #41009

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Oct 4, 2023

Description

Related Issue

QA Scenarios

Scenarios

  • try to send mail from admin section
  • send invite via CalDAV

Mail Setups to test

  • send mail
  • qmail
  • smtp with ssl
  • smtp without ssl

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs
Copy link

update-docs bot commented Oct 4, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@DeepDiver1975 DeepDiver1975 mentioned this pull request Oct 4, 2023
14 tasks
@DeepDiver1975 DeepDiver1975 force-pushed the chore/replace-swiftmailer-with-symfony-mailer branch 2 times, most recently from 4d2c394 to ea838aa Compare October 4, 2023 20:05
@phil-davis phil-davis self-requested a review October 4, 2023 20:35
@DeepDiver1975 DeepDiver1975 force-pushed the chore/replace-swiftmailer-with-symfony-mailer branch 2 times, most recently from bc46a27 to 07a47dd Compare October 5, 2023 10:45
@DeepDiver1975
Copy link
Member Author

DeepDiver1975 commented Oct 5, 2023

@mmattel we have dropped one config setting - also the admin ui looks a bit different now .....
In addition the smtp encryption option is now either 'ssl/tls' or 'none' .... 'STARTTLS' has been dropped

config/config.sample.php Outdated Show resolved Hide resolved
@mmattel
Copy link
Contributor

mmattel commented Oct 5, 2023

smtp encryption option is now either 'ssl/tls' or 'none' .... 'STARTTLS' has been dropped

Same as written in the code comment above, this is a release notes thing and needs mentioning there --> @pako81

@mmattel
Copy link
Contributor

mmattel commented Oct 5, 2023

the admin ui looks a bit different now

Can one drop me a screenshot we can use for docs into: owncloud/docs-server#1137 ? and clarify for which version this change is targeted?

@pako81 @jnweiger fyi

@DeepDiver1975 DeepDiver1975 force-pushed the chore/replace-swiftmailer-with-symfony-mailer branch 2 times, most recently from 026c2ac to 4d7271e Compare October 5, 2023 13:10
@DeepDiver1975
Copy link
Member Author

@individual-it @phil-davis can I ask you for a quick look - THX a lot:
image
image

@individual-it
Copy link
Member

The failing case is that sendmail is set as the mode but no sendmail is installed/configured on the system (/usr/sbin/sendmail -bs).
Looks like the exception is thrown but does not cause occ to return 1 as exit code

@DeepDiver1975 DeepDiver1975 force-pushed the chore/replace-swiftmailer-with-symfony-mailer branch from b7c4f0c to 4bfd453 Compare October 6, 2023 10:38
@sonarcloud
Copy link

sonarcloud bot commented Oct 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 2 Code Smells

74.5% 74.5% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and tests all pass.
I made a few notes mainly about backward-compatibility. The way the ownCloud Mailer etc classes are currently structured, they expose parts of SwiftMailer, so to get rid of SwiftMailer there have to be changes to public method interfaces.
What do we do about that for oC core major version 10 with PHP 7.4?

(for PHP 8.2 it is easier - we would bump the major version of oC core to 11)

composer.phar Outdated Show resolved Hide resolved
@@ -96,7 +95,6 @@ public function setMailSettings(
$mail_smtpmode,
$mail_smtpsecure,
$mail_smtphost,
$mail_smtpauthtype,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do we do about things like this?
In apps that we manage, and that happen to call setMailSettings, we can adjust the app and coordinate the release.
For "unknown" apps, this would be a BC break.
Or am I thinking wrong?

]);

return $failedRecipients;
return [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we keeping the "return array" behavior for backward compatibility?
This method now always either:

  • returns an empty array; or
  • throws an exception

So it could just "return void", indicating success. But maybe there are other callers that are expecting the old behavior, and think that success is indicated by an empty array returned.

lib/private/Mail/Message.php Show resolved Hide resolved
*/
public function getSwiftMessage() {
return $this->swiftMessage;
public function getMessage(): Email {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the method name changes here - so definitely not backward-compatible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to this the original design did not have an iMessage.
Never the less: yes - this breaks API.

@phil-davis
Copy link
Contributor

This can wait for merge until release-10.13.2 is out of the way, so we have time to discuss what happens for releases after doing this change for the PHP 7.4 code base - will it be "the usual" 10.14.0 minor version bump, and we work out how to address backward-compatibility issues (for example, that any real backward-compatibility issues can be handled OK for any apps that are affected).

Or would this cause a major version bump, forcing an 11.0.0 release that supports PHP 7.4...

@DeepDiver1975
Copy link
Member Author

From my understanding oc11 is php8.2
We can also merge this or into the php8.2 pr

@DeepDiver1975 DeepDiver1975 force-pushed the chore/replace-swiftmailer-with-symfony-mailer branch 3 times, most recently from 12e9080 to ad2bb6d Compare November 13, 2023 22:28
Copy link

sonarcloud bot commented Nov 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 2 Code Smells

74.5% 74.5% Coverage
0.0% 0.0% Duplication

@phil-davis
Copy link
Contributor

I suppose this is blocked/stalled for now. Can't easily be part of 10.14 because of backward-compatibility issues that are not easily avoided.

@DeepDiver1975
Copy link
Member Author

I planned to do this as part of #40981 🤷

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.

Swiftmailer has reached EOL in Nov '21
4 participants