IMailDriver
in
Interface IMailDriver
This interface defines the basic contract for classes that handle sending emails. Classes implementing this interface should provide methods for setting the configuration of the driver, and for sending emails to recipients.
Table of Contents
Methods
- send() : bool
- Sends an email to the specified recipient(s).
- setConfig() : void
- Sets the configuration of the driver.
Methods
send()
Sends an email to the specified recipient(s).
public
send(array<string|int, mixed>|string $to, string $from, string $from_name, string $subject, string $body, array<string|int, mixed>|null $attachments[, bool $isBodyHtml = true ][, string $charset = "UTF-8" ]) : bool
Parameters
- $to : array<string|int, mixed>|string
-
Mail addresses of the recipients
- $from : string
-
Sender's email address
- $from_name : string
-
Sender's name
- $subject : string
-
Subject of the email
- $body : string
-
Body of the email (can be in HTML or plain text format)
- $attachments : array<string|int, mixed>|null
-
Array of filenames of attachments to be sent with the email
- $isBodyHtml : bool = true
-
True if the body is in HTML format, false if it is in plain text format
- $charset : string = "UTF-8"
-
Charset for content encoding
Return values
bool —True if the email was sent successfully, false otherwise
setConfig()
Sets the configuration of the driver.
public
setConfig(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
-
Configuration array