Skip to content

starringjane/wordplate-mail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starring Jane

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

Credits

Special thanks to the contributors of wordplate for allowing us to create Wordpress websites in a modern development environment