Download the PHP package bayfrontmedia/mail-manager without Composer
On this page you can find all versions of the php package bayfrontmedia/mail-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bayfrontmedia/mail-manager
More information about bayfrontmedia/mail-manager
Files in bayfrontmedia/mail-manager
Package mail-manager
Short Description Framework agnostic library to queue and send emails from multiple services using a consistent API.
License MIT
Homepage https://github.com/bayfrontmedia/mail-manager
Informations about the package mail-manager
Mail Manager
Framework agnostic library to queue and send emails from multiple services using a consistent API.
NOTE: Development is currently underway to integrate additional mail services (adapters) to Mail Manager, and these will be released as they are developed.
- License
- Author
- Requirements
- Installation
- Usage
License
This project is open source and available under the MIT License.
Author
Requirements
- PHP
^8.0
(Tested up to8.4
) PDO
PHP extension
Installation
Usage
NOTE: All exceptions thrown by Mail Manager extend Bayfront\MailManager\Exceptions\MailException
, so you can choose to catch exceptions as narrowly or broadly as you like.
Adapter
A Bayfront\MailManager\AdapterInterface
must be passed to both the Bayfront\MailManager\Mail
, and the Bayfront\MailManager\MailQueue
constructors.
There are a variety of adapters available, each with their own required configuration.
In addition, you may also create and use your own adapters to be used with Mail Manager.
All adapters have a getInstance()
method, which can be used to get the underlying instance used by the adapter.
PHPMailer
The PHPMailer adapter allows you to use PHPMailer for sending messages.
The PHPMailer adapter also has a testConnection()
method you can use to test for a successful connection to the SMTP server.
Start using Mail Manager
You may choose one of the following classes to use:
The Bayfront\MailManager\Mail
class allows for the creation and immediate sending of messages.
No database is needed.
The Bayfront\MailManager\MailQueue
class is the same as above, only it requires a PDO
instance to work with queued messages.
Queued messages allow for messages to be sent programmatically at a later date.
Mail default configuration
MailQueue default configuration
Public methods
- create
- addAddress
- addCc
- addBcc
- addAttachment
- discard
- send
MailQueue only
- addQueue
- removeQueue
- getQueue
- sendQueue
create
Description:
Create a new message.
Parameters:
$message
(array)
Returns:
- (self)
Throws
Bayfront\MailManager\Exceptions\MessageException
Example:
addAddress
Description:
Add a "To" recipient.
Parameters:
$address
(string)$name = NULL
(string|null): IfNULL
, a name will not be defined
Returns:
- (self)
Example:
addCc
Description:
Add a "Cc" recipient.
Parameters:
$address
(string)$name = NULL
(string|null): IfNULL
, a name will not be defined
Returns:
- (self)
Example:
addBcc
Description:
Add a "Bcc" recipient.
Parameters:
$address
(string)$name = NULL
(string|null): IfNULL
, a name will not be defined
Returns:
- (self)
Example:
addAttachment
Description:
Add an attachment.
Parameters:
$file
(string): Path to the file$name = NULL
(string|null): New name to assign to file. IfNULL
, the existing name will be used.
Returns:
- (self)
Example:
discard
Description:
Discard message.
Parameters:
- None
Returns:
- (self)
Example:
send
Description:
Send message.
Parameters:
- None
Returns:
- (void)
Throws:
Bayfront\MailManager\MessageException
Example:
addQueue
NOTE: This method is only available with the MailQueue
class.
Description:
Queue message.
Parameters:
$date_due
(\DateTimeInterface
)$priority = 5
(int): Messages will be sent in order by due date sorted by priority in descending order
Returns:
- (void)
Throws:
Bayfront\MailManager\QueueException
Example:
removeQueue
NOTE: This method is only available with the MailQueue
class.
Description:
Remove a given ID from the queue.
Parameters:
$id
(int): Uniqueid
from the database table
Returns:
- (bool)
Throws:
Bayfront\MailManager\QueueException
Example:
getQueue
NOTE: This method is only available with the MailQueue
class.
Description:
Get all messages in queue that are due, up to a given limit.
Parameters:
$limit = 0
(int):0
to get all
Returns:
- (array)
Throws:
Bayfront\MailManager\QueueException
Example:
sendQueue
NOTE: This method is only available with the MailQueue
class.
Description:
Send messages in queue that are due, up to a given limit.
Parameters:
$limit = 0
(int):0
to send all
Returns:
- (array)
Throws:
Bayfront\MailManager\QueueException
Example:
The returned array contains a result summary with the following structure:
All versions of mail-manager with dependencies
ext-pdo Version *
bayfrontmedia/php-array-helpers Version ^2.0
phpmailer/phpmailer Version ^6.9
soundasleep/html2text Version ^2.1