starring-jane / wordplate-mail
Adds mail settings to your environment configuration
Installs: 2 750
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
README
Wordplate Mail
Adds mail settings to your environment configuration
Installation
composer require starring-jane/wordplate-mail
Create a WordplateMail instance in functions.php
use StarringJane\WordplateMail\WordplateMail; WordplateMail::register();
Usage
Add your smtp settings to your .env file
MAIL_DRIVER=smtp MAIL_HOST=localhost MAIL_PORT=465 MAIL_USERNAME=user MAIL_PASSWORD=pass MAIL_ENCRYPTION=tls MAIL_FROM_NAME="Sender Name" MAIL_FROM_ADDRESS="no-reply@domain.com"
You can also send trough the local mail driver
MAIL_DRIVER=mail MAIL_HOST=localhost MAIL_PORT=25 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_NAME="Sender Name" MAIL_FROM_ADDRESS="no-reply@domain.com"
Override variables in code
Sometimes you might want to set variables dynamicaly
use StarringJane\WordplateMail\WordplateMail; WordplateMail::register() ->set('MAIL_FROM_NAME', 'Starring Jane') ->set('MAIL_FROM_ADDRESS', function () { $domain = str_replace('www.', '', $_SERVER['SERVER_NAME']); return 'no-reply@' . $domain; });
Contributors
- Maxim Vanhove (maxim@starringjane.com)
Credits
Special thanks to the contributors of wordplate for allowing us to create Wordpress websites in a modern development environment