feat(mailer): Office365 OAuth2 SMTP support#269
Open
tsgoff wants to merge 25 commits into
Open
Conversation
https://outlook.office.com/SMTP.Send - Required for SMTP https://outlook.office.com/IMAP.AccessAsUser.All - For IMAP https://outlook.office.com/POP.AccessAsUser.All - For POP offline_access - For refresh token
Implement direct SMTP client that sends uppercase AUTH XOAUTH2 (matching Office365 server advertisement) instead of lowercase, resolving XOAUTH2 authentication failures. Changes: - Office365SmtpTransport: Custom SMTP implementation with: * Direct stream socket connection to smtp.office365.com:587 * TLS STARTTLS encryption negotiation * Uppercase AUTH XOAUTH2 command (critical fix) * MIME multipart support for attachments * Automatic OAuth2 token refresh (TTL < 30 seconds) * Full error handling and logging - Office365SmtpException: SMTP-specific exception class - MailerTransportFactory: Route Office365 accounts to new custom transport instead of PhpMailerOAuth Result: Office365 OAuth2 email sending now works without external proxy. XOAUTH2 authentication no longer fails due to case sensitivity.
…e::fetchRow() returns empty array [] when no rows found, not null. All null checks changed to empty() to properly handle empty arrays. Fixes: - getAccount() - null check - getAccountByEmailAddress() - null check - getAccountByUserId() - null check - getAccessToken() - null check - getAccountProperties() - null check - getScopes() - null check This was preventing Office365 OAuth accounts from being found by email address.
…dd database schema for Office365 integration including tables for access tokens, accounts, account properties, and scopes.
…sportFactory, and emailbackup
…roperties to prevent duplicates
…ate emailbackup IMAP type options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Übersicht
Dieser PR ergänzt OpenXE um vollständige Microsoft Office365 OAuth2-Unterstützung für den Mailversand um den Workaround abzulösen: https://openxe.org/wiki/index.php?entry%2F9-nutzung-von-microsoft-office365-mailadressen-oauth2%2F=
Änderungen
Office365 OAuth2 Mailversand
classes/Modules/Office365Api/(Account-Gateway, Authorization-Service, Credentials-Service, DTOs, Exceptions) — analog zum bestehendenGoogleApi-Modul.Office365SmtpTransport, derAUTH XOAUTH2in Großbuchstaben sendet (Office365 lehnt das von PHPMailer gesendeteAUTH xoauth2mit „Requested auth method not available: xoauth2" ab).emailbackup_edit.tpl(Dropdown-Eintrag „Microsoft Office365 OAuth2" + Authorize-Button) sowie OAuth-Authorize/Callback-Actions inemailbackup.php.Datenbankstruktur
office365_account,office365_access_token,office365_account_property,office365_account_scope) ergänzt in:upgrade/data/db_schema.json→ wird vom Upgrade-Tool als Soll-Schema verwendet.migrations/office365_oauth_tables.sqlbleibt für Updates bestehender Installationen erhalten.CI
.github/workflows/ci.ymlmit PHP 8.4 für jeden Push und jeden Pull Request:vendor/).db_schema.jsonundcomposer.json.struktur.sqlin MariaDB 10.6 und prüft, dass alle Office365-Tabellen erzeugt werden + Cross-Check zwischendb_schema.jsonundstruktur.sql.AUTH_OFFICE365durchgängig in Account, SystemMailer, Factory und UI verdrahtet ist.Dokumentation
OFFICE365_OAUTH_SETUP.md,OFFICE365_OAUTH2_DOCUMENTATION.md,OFFICE365_SMTP_CLIENT_TESTING.md).Testdurchführung
Setup für bestehende Installationen
git pullmysql -u … -p … openxe < migrations/office365_oauth_tables.sqloffice365_client_id,office365_client_secret,office365_redirect_uri,office365_tenant_idhinterlegen.Details siehe OFFICE365_OAUTH2.md.