simonmao/simple-mailer

A simple mail client based on the phpmailer package.

dev-develop 2020-07-11 12:32 UTC

This package is auto-updated.

Last update: 2024-09-11 21:44:13 UTC


README

Usage

composer require simonmao/simple-mailer

Example

Mail Config

config.yaml

email:
  debug: true
  host: smtpserver.com
  port: 587
  username: yourname@domain.com
  password: password
  encryption: tls # tls/ssl
  fromEmail: yourname@domain.com
  fromName: "Mailer"

Load Config

$conf = Noodlehaus\Config::load('config.yaml')
    ->get('email');

Initialization

$mailer = new \SimpleMailer\SimpleMailer($conf);

Send Text Mail

$bool = $mailer->sendText('xxx@email.com', 'Title', 'hello');
var_dump($bool);

Send HTML Mail

$bool = $mailer->sendHTML('xxx@email.com', 'Title', '<h1>hello</h1>');
var_dump($bool);

Dependents

  1. phpmailer/phpmailer