MailerService
in package
Mailer service Handles email sending functionality for various purposes including notifications, admin communications, and customer invoices
Table of Contents
Properties
- $logger : LoggerInterface
- $mailer : MailerInterface
- $parameterBag : ParameterBagInterface
- $repository : ConfigAppRepository
Methods
- __construct() : mixed
- Constructor
- sendEmail() : bool
- Send a templated email
- sendEmailAdminAccountCreated() : bool
- Send admin notification email for account creation
- sendEmailToCustomer() : bool
- Send email to customer with invoice attachment
- sendErrorNotification() : bool
- Send error notification email with flexible context
Properties
$logger read-only
private
LoggerInterface
$logger
$mailer read-only
private
MailerInterface
$mailer
$parameterBag
private
ParameterBagInterface
$parameterBag
$repository
private
ConfigAppRepository
$repository
Methods
__construct()
Constructor
public
__construct(MailerInterface $mailer, ConfigAppRepository $repository, ParameterBagInterface $parameterBag, LoggerInterface $logger) : mixed
Parameters
- $mailer : MailerInterface
-
Symfony mailer interface
- $repository : ConfigAppRepository
-
Configuration repository
- $parameterBag : ParameterBagInterface
-
Parameter bag for configuration values
- $logger : LoggerInterface
sendEmail()
Send a templated email
public
sendEmail(string $to, string $subject, string $path, mixed $users, mixed $entity[, mixed $threshold = null ]) : bool
Parameters
- $to : string
-
Recipient email address
- $subject : string
-
Email subject
- $path : string
-
Template path
- $users : mixed
-
User data for template context
- $entity : mixed
-
Entity data for template context
- $threshold : mixed = null
Return values
bool —True on success, false on failure
sendEmailAdminAccountCreated()
Send admin notification email for account creation
public
sendEmailAdminAccountCreated(string $to, string $subject, string $path, mixed $users) : bool
Parameters
- $to : string
-
Recipient email address
- $subject : string
-
Email subject
- $path : string
-
Template path
- $users : mixed
-
User data for template context
Return values
bool —True on success, false on failure
sendEmailToCustomer()
Send email to customer with invoice attachment
public
sendEmailToCustomer(string|null $to, string|null $subject, string|null $content, mixed $invoice[, ArrayCollection|null $addressCc = null ][, ArrayCollection|null $addressCCi = null ]) : bool
Parameters
- $to : string|null
-
Recipient email address
- $subject : string|null
-
Email subject
- $content : string|null
-
Email HTML content
- $invoice : mixed
-
Invoice attachment
- $addressCc : ArrayCollection|null = null
-
CC email addresses collection
- $addressCCi : ArrayCollection|null = null
-
BCC email addresses collection
Return values
bool —True on success, false on failure
sendErrorNotification()
Send error notification email with flexible context
public
sendErrorNotification(string $to, string $subject, string $path, array<string, mixed> $context) : bool
Parameters
- $to : string
-
Recipient email address
- $subject : string
-
Email subject
- $path : string
-
Template path
- $context : array<string, mixed>
-
Data for template context
Return values
bool —True on success, false on failure