This is an old revision of the document!
Table of Contents
NotificationService
Layer: Service · Source: lib/service/NotificationService.php:21 (lines 21–419)
class NotificationService
NotificationService Class
Service for sending email notifications using Symfony Mailer Supports SMTP configuration for various email providers
Docblock Metadata
^ Tag ^ Value ^ | ''@category'' | Service Class | | ''@author'' | Scriptlog | | ''@license'' | MIT | | ''@version'' | 1.0 | | ''@since'' | Since Release 1.0 |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (11)
^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''__construct()'' | Constructor | 52 | | private | ''loadConfiguration()'' | Load mail configuration | 63 | | public | ''send()'' | Send email notification | 137 | | protected | ''getMailer()'' | Get Mailer instance | 166 | | protected | ''createEmail()'' | Create Email instance | 181 | | private | ''applyEmailOptions()'' | Apply additional options to email | 201 | | public | ''sendDataRequestConfirmation()'' | Send GDPR data request confirmation email to user | 228 | | public | ''sendAdminNotification()'' | Send notification to admin about new data request | 278 | | public | ''sendRequestCompleted()'' | Send data request completion email | 325 | | public | ''sendProfileDeletionConfirmation()'' | Send profile deletion confirmation | 369 | | public | ''getSmtpConfig()'' | Get SMTP configuration (for admin settings page) | 409 |
__construct()
public function __construct(?ConfigurationService $configService = null)
lines 52–56 (5)
Constructor
Load SMTP configuration from database or config.php
^ Parameter ^ Type ^ Default ^ Description ^ | ''$configService'' | [[scriptlog:lib:service:configurationservice|''?ConfigurationService'']] | ''null'' | //none// |
loadConfiguration()
private function loadConfiguration()
lines 63–126 (64)
Load mail configuration
Takes no parameters.
Returns: (none declared) — void
send()
public function send($to, $subject, $body, $options = [])
lines 137–157 (21)
Send email notification
^ Parameter ^ Type ^ Default ^ Description ^ | ''$to'' | ''(untyped)'' | //required// | Email address to send to | | ''$subject'' | ''(untyped)'' | //required// | Email subject | | ''$body'' | ''(untyped)'' | //required// | Email body (HTML or plain text) | | ''$options'' | ''(untyped)'' | ''[]'' | Additional options |
Returns: (none declared) — bool
getMailer()
protected function getMailer()
lines 166–170 (5)
Get Mailer instance
Protected to allow mocking in tests
Takes no parameters.
Returns: (none declared) — \Symfony\Component\Mailer\MailerInterface
createEmail()
protected function createEmail($to, $subject, $body, $isHtml = true)
lines 181–196 (16)
Create Email instance
^ Parameter ^ Type ^ Default ^ Description ^ | ''$to'' | ''(untyped)'' | //required// | //none// | | ''$subject'' | ''(untyped)'' | //required// | //none// | | ''$body'' | ''(untyped)'' | //required// | //none// | | ''$isHtml'' | ''(untyped)'' | ''true'' | //none// |
Returns: (none declared) — \Symfony\Component\Mime\Email
applyEmailOptions()
private function applyEmailOptions($email, $Cc, $Bcc, $replyTo)
lines 201–218 (18)
Apply additional options to email
^ Parameter ^ Type ^ Default ^ Description ^ | ''$email'' | ''(untyped)'' | //required// | //none// | | ''$Cc'' | ''(untyped)'' | //required// | //none// | | ''$Bcc'' | ''(untyped)'' | //required// | //none// | | ''$replyTo'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared)
sendDataRequestConfirmation()
public function sendDataRequestConfirmation($email, $requestType, $requestId)
lines 228–267 (40)
Send GDPR data request confirmation email to user
^ Parameter ^ Type ^ Default ^ Description ^ | ''$email'' | ''(untyped)'' | //required// | User's email address | | ''$requestType'' | ''(untyped)'' | //required// | Type of request (export/deletion) | | ''$requestId'' | ''(untyped)'' | //required// | Request ID |
Returns: (none declared) — bool
sendAdminNotification()
public function sendAdminNotification($adminEmail, $userEmail, $requestType, $requestId)
lines 278–316 (39)
Send notification to admin about new data request
^ Parameter ^ Type ^ Default ^ Description ^ | ''$adminEmail'' | ''(untyped)'' | //required// | Admin email address | | ''$userEmail'' | ''(untyped)'' | //required// | User's email address | | ''$requestType'' | ''(untyped)'' | //required// | Type of request | | ''$requestId'' | ''(untyped)'' | //required// | Request ID |
Returns: (none declared) — bool
sendRequestCompleted()
public function sendRequestCompleted($email, $requestType)
lines 325–361 (37)
Send data request completion email
^ Parameter ^ Type ^ Default ^ Description ^ | ''$email'' | ''(untyped)'' | //required// | User's email address | | ''$requestType'' | ''(untyped)'' | //required// | Type of request |
Returns: (none declared) — bool
sendProfileDeletionConfirmation()
public function sendProfileDeletionConfirmation($email)
lines 369–402 (34)
Send profile deletion confirmation
^ Parameter ^ Type ^ Default ^ Description ^ | ''$email'' | ''(untyped)'' | //required// | User's email address |
Returns: (none declared) — bool
getSmtpConfig()
public function getSmtpConfig()
lines 409–418 (10)
Get SMTP configuration (for admin settings page)
Takes no parameters.
Returns: (none declared) — array
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
