Download the PHP package wapplersystems/microsoft-graph-mailer without Composer

On this page you can find all versions of the php package wapplersystems/microsoft-graph-mailer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package microsoft-graph-mailer

Microsoft Graph Mailer for TYPO3

Sends TYPO3 system emails via the Microsoft Graph API using OAuth 2.0 client credentials. Built on top of wapplersystems/oauth-service for token acquisition, caching, refresh and BE-configurable client setup.

No SMTP. No mailbox password. No interactive user consent needed.

Why

Office 365 / Exchange Online is phasing out Basic Authentication for SMTP AUTH. Modern delivery uses the Microsoft Graph sendMail endpoint with an OAuth2 bearer token. This extension wires that endpoint into TYPO3's existing Symfony Mailer pipeline so any MailerInterface consumer sends through Graph transparently.

Requirements

Installation

Configuration

1. Azure / Microsoft Entra ID — App registration

  1. https://entra.microsoft.comApplications → App registrations → New registration
    • Name: TYPO3 Mailer – yourdomain.com
    • Account type: Single tenant
    • Redirect URI: leave empty (app-only flow, no user login)
  2. API permissions → Microsoft Graph → Application permissions
    • Add Mail.Send
    • Click Grant admin consent
  3. Certificates & secrets → New client secret
    • Copy the Value (only shown once)
  4. Note from the Overview page:
    • Directory (tenant) ID
    • Application (client) ID

2. Restrict the app to one mailbox (Exchange Online PowerShell)

Without this step the app could send from any mailbox in the tenant.

3. TYPO3 — OAuth Services backend module

Go to System → OAuth Services → Clients → New:

Field Value
Provider microsoft_graph
Active
Client ID Application (client) ID from Azure
Client Secret Client secret value from Azure
Scopes https://graph.microsoft.com/.default
Metadata (JSON) {"tenant_id": "<directory tenant id>", "sender_upn": "[email protected]"}

Save. The token is fetched lazily on the first mail send and cached by oauth-service (TYPO3 oauth_service cache backend) for its expires_in lifetime.

4. Wire the transport

Add to config/system/additional.php (or set via Admin Tools → Settings → Configure Installation-wide Options → MAIL):

That is the only TYPO3-side configuration. No DSN, no SMTP settings, no mailbox password. The transport reads sender_upn and tenant_id from the OAuth client's metadata at send time.

5. (Recommended) Scheduler

oauth-service ships two console commands. For client-credentials only the cache invalidation matters, but the monitor catches misconfigured credentials early:

Testing

A successful send returns silently. On error the transport throws a GraphMailerException with the Microsoft request-id header — quote that in any Microsoft support case.

Failure handling — the spool fallback

To avoid silently dropping emails when Microsoft Graph rejects a request (no OAuth client configured, expired secret, license issue, 401/403/404 from sendMail, …), the transport writes the original message as an .eml file plus a .json payload record to a spool directory and lets the caller proceed. Default location:

Each undelivered message becomes a pair:

Audit

shows everything currently in the spool with the original failure reason and retry count.

Automatic retry (recommended)

typo3 microsoft-graph-mailer:resend-undelivered iterates the spool and re-posts each entry's graph_payload to Microsoft Graph. On success the pair is deleted; on failure the entry stays in the spool with retry_count incremented and last_retry_error recorded.

Options:

Schedule this command in the TYPO3 Scheduler module as "Microsoft Graph: resend undelivered emails" (registered task) every five minutes. The task exposes a Batch size and Max age (days) field in the BE form.

Configuration

Sender address & defaultMailFromAddress

The transport calls /users/{sender_upn}/sendMail — Graph treats that mailbox as the authenticated sender. The email's From: header is taken from the Symfony Email::getFrom() (typically TYPO3's $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']) and placed into message.from of the Graph payload.

When defaultMailFromAddress differs from sender_upn, Exchange Online requires the sender_upn mailbox to hold Send As (or Send on Behalf) permission for the defaultMailFromAddress mailbox. Without it, Graph rejects the request:

Fix in Exchange Online PowerShell:

Or in the Microsoft 365 Admin Center: Active users → \<defaultMail- FromAddress> → Mail → Manage mailbox permissions → Send as → add <sender_upn>.

Notes:

Multiple senders

The transport always targets the first active microsoft_graph OAuth client. To send from a different mailbox in the same tenant, change the sender_upn metadata value. To use a different tenant entirely, create a second client row and deactivate the first.

Limitations

License

GPL-2.0-or-later


All versions of microsoft-graph-mailer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
typo3/cms-core Version ^14
wapplersystems/oauth-service Version ^14.2
symfony/mailer Version ^7.0
symfony/mime Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wapplersystems/microsoft-graph-mailer contains the following files

Loading the files please wait ...