Usage 

Convert a message for Microsoft Graph 

Pass a Symfony SentMessage to MSGraphMailApiService::convertToGraphMessage(). It returns an array with the Graph message object and the resolved sender address:

use OliverKroener\Helpers\MSGraphApi\MSGraphMailApiService;
use Symfony\Component\Mailer\SentMessage;

/** @var SentMessage $sentMessage */
$result = MSGraphMailApiService::convertToGraphMessage($sentMessage);

$graphMessage = $result['message']; // Microsoft\Graph\Model\Message
$fromAddress  = $result['from'];    // string, the sender address

// $graphMessage can now be passed to the Microsoft Graph "sendMail" request.
Copied!

Inline images referenced in the HTML body via cid: are detected automatically from their Content-Disposition: inline header and carried over with their Content-ID, so embedded graphics render in the delivered mail.

Dynamic property accessors 

Use ReflectionPropertiesTrait to add magic getters and setters to any class. The trait resolves the property through reflection:

use OliverKroener\Helpers\Traits\ReflectionPropertiesTrait;

class Contact
{
    use ReflectionPropertiesTrait;

    private string $email = '';
}

$contact = new Contact();
$contact->setEmail('ok@oliver-kroener.de'); // magic setter
echo $contact->getEmail();                   // magic getter
Copied!

Calling an accessor for a property that does not exist throws an Exception.

Development tooling 

The extension ships with static analysis and coding-standards tooling, exposed as Composer scripts:

composer run stan       # PHPStan (level 5, TYPO3 stubs)
composer run cs:check   # PHP-CS-Fixer dry-run (TYPO3 coding standards)
composer run cs:fix     # PHP-CS-Fixer apply
Copied!