Code Monkey home page Code Monkey logo

groupmailer's Introduction

TYPO3 Extension groupmailer

Usage

Generate Mailing via MailService

Parameter for generateMailing:

  • $backendGroups [array]: an array with backend groups
  • $subject [string]: the email subject. The max length is currently 255. This can be increased via the TCA
  • $bodytext [string]: the email content
  • optional $senderEmail [string]: the sender email. If not defined the fallback $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] is used
  • optional $senderName [string]: the sender name. If not defined the fallback $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'] is used
  • optional $mailFormat [string]: default FluidEmail::FORMAT_BOTH valid options are FluidEmail::FORMAT_BOTH, FluidEmail::FORMAT_HTML or FluidEmail::FORMAT_PLAIN
  • optional $context [string]: default Context::FRONTEND valid options are Context::FRONTEND, Context::BACKEND
  • optional $workflowState [int]: default Workflow::STATE_DRAFT valid options are Workflow::STATE_DRAFT, Workflow::STATE_REVIEW, Workflow::STATE_APPROVED, Workflow::STATE_REJECTED
  • optional $attachments [array]: an array with SysFile Objects

How to use the mailService

        $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
        );

Generate the mail queue

The mail queue can be generated via the groupmailer:generateMailQueue command.

./vendor/bin/typo3 groupmailer:generateMailQueue

This can be automated via an Scheduler task.

Process the mail queue (sends the actual mails)

The mail queue can be generated via the groupmailer:processMailQueue command.

./vendor/bin/typo3 groupmailer:processMailQueue

This can be automated via an Scheduler task.

Configuration

This extension can be configured in the "Extension Configuration" (Backend Module 'Settings' -> "Extension Configuration")

Configuration options

  • Storage Pid [integer]: Sets the PID on which the records are stored
  • Emails to sent per execution [integer]: Defines how many mails should be sent on one execution of the process mail queue command
  • Recursion Level [integer]: Defines the recursion level for the given backend user groups in a mailing

Workflow

  • DRAFT: mailings with this status will be ignored if mail queue entries will be generated
  • REVIEW: mailings with this status will be ignored if mail queue entries will be generated
  • REJECTED: mailings with this status will be moved into locked mailings and no mail queue entries will be generated
  • APPROVED: queue entries will be generated on the next execution of the generateMailQueue command

groupmailer's People

Contributors

sebastianstein avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.