Send email using Sendgrid. Gmail will also supported soon!
This library is still under heavy development, so expect the
changes soon :)
- Install using composer
composer require crazymeeks/phpmails
If this command fails, copy this code in 'autoload' of your composer.json
"crazymeeks/phpmails": "dev-master"
and execute composer update
MAILER=sendgrid
MAIL_PROTOCOL=TLS
MAIL_PORT=587
MAIL_API_KEY=yourmailerapikey
MAIL_FROM=emailsender@example.com
USERNAME=username
PASSWORD=password
MAIL_SUBJECT="This subject must enclosed with double quote"
Find vendor\crazymeeks\phpmail\config\environment.php
and add your mail service credentials
Put this code in your php file
use Crazymeeks\Mailer\MailManager;
$mailer = MailManager::initialize();
then send email by calling the to()->send()
is the the path to your custom email
template file delimited by dot(.)
custom template file should be in .phtml extension
This is the array of data you need to pass in your view
$mailer->to('receiver@example.com')->send(null, array('name' => $name, 'username' => 'test', 'password' => '1234'));
$mailer->to('receiver@example.com')->send('views.email', array('name' => $name, 'username' => 'test', 'password' => '1234'));
#Note:
Passing an array in to() method will not work!
html
body
Name:
Username:
Password:
body
html
Jeff Claud[jeffclaud17@gmail.com]