marcosdipaolo / mailer
A PHP Mailer Package
1.0.3
2022-08-26 16:04 UTC
Requires
- php: >=8.1
- symfony/mailer: ^6.1
- vlucas/phpdotenv: ^5.4
This package is auto-updated.
Last update: 2025-05-10 05:29:07 UTC
README
A PHP Mailer library
Mailer is a super simple mail package wrapping the Symfony SwiftMailer
Dependencies
This package -as a standalone- has a dependency that has to be manually installed. This of course applies if your app doesn't already have it installed.
This dependency is the vlucas\phpdotenv
package.
composer require vlucas/phpdotenv
Also, a properly configured env
file
Environmental Variables
This package needs the following variables set up in you env file, at least as a empty field:
MAIL_HOST MAIL_USERNAME MAIL_PASSWORD MAIL_PORT MAIL_ENCRYPTION
Usage
With the helper mailer()
which is the same as new MDP\Mailer
mailer()->send($subject, $mailFrom, $nameFrom, $recipients, $body);
You can add as a sixth parameter the priority as an integer, being 1
the highest and 5
the lowest.
This can be achieved also using the swiftmailer constants:
Swift_Mime_SimpleMessage::PRIORITY_HIGHEST; // 1 Swift_Mime_SimpleMessage::PRIORITY_HIGH; // 2 Swift_Mime_SimpleMessage::PRIORITY_NORMAL; // 3 Swift_Mime_SimpleMessage::PRIORITY_LOW; // 4 Swift_Mime_SimpleMessage::PRIORITY_LOWEST; // 5