PHP code example of in2code / groupmailer

1. Go to this page and download the library: Download in2code/groupmailer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

in2code / groupmailer example snippets


        $beGroupRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Domain\Repository\BackendUserGroupRepository::class);
        $beGroups = [
            $beGroupRepository->findByUid(2),
            $beGroupRepository->findByUid(4)
        ];
        
        $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
        $attachments = [
            $fileRepository->findByUid(2)
        ];

        $mailService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\In2code\Groupmailer\Service\MailService::class);
        $mailService->generateMailing(
            $beGroups,
            'Betreff',
            'Inhalt',
            '[email protected]',
            'Sender Name',
            \TYPO3\CMS\Core\Mail\FluidEmail::FORMAT_PLAIN,
            \In2code\Groupmailer\Context\Context::BACKEND,
            \In2code\Groupmailer\Workflow\Workflow::STATE_DRAFT,
            $attachments
        );