marcosdipaolo / mailer
A PHP Mailer Package
Installs: 36
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/marcosdipaolo/mailer
Requires
- php: >=8.1
- symfony/mailer: ^6.1
- vlucas/phpdotenv: ^5.4
This package is auto-updated.
Last update: 2025-12-10 06:46:05 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