Skip to content
A convenient package for sending mass html emails.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Super Mailer

A convenient package for sending mass html emails.

What does it do?

Instead of writing your own scripts to send emails, you can quickly configure the package with your SMTP details, create your message body and subject templates, send the email and be done with it! It's that simple!


Clone the repository and use composer to install the dependencies.

composer install

Then include vendor/autoload.php in your PHP file to start using the Masnun\SuperMailer\SuperMailer class.


The Masnun\SuperMailer\SuperMailer class constructor has the following paramters:

  • SMTP Host
  • SMTP Port
  • SMTP Username
  • SMTP Password
  • Subject Template (String)
  • Path to message body template file
  • Your Name
  • Your Email address

Your name and email address is used as the "From" header of the email.

The object instance has a method sendEmail that we use to send the emails to our recipients. The method takes these arguments:

  • Name of the recipient
  • Email address of the recipient
  • The array of data that will be passed to the body and subject templates

Code Sample

// File: config.php

$smtp = [
    'host' => '',
    'port' => 587,
    'username' => '',
    'password' => 't4VTk0BdNPC7I9-GRY'
// File: index.php

require_once 'vendor/autoload.php';
require_once 'config.php';

use Masnun\SuperMailer\SuperMailer;

$mailer = new SuperMailer(
    // smtp data

    // Subject template
    'Hello {{name}}!',

    // Message body template

    //Sender details
    "Abu Ashraf Masnun",

$sampleUsersArray = [

        'name' => "Masnun",
        'email' => '',
        'token' => '2eff42576ee8fc0dccdd38c0108fe8af'

        'name' => 'The Doctor',
        'email' => '',
        'token' => '2aa5a1d13d655a57dbc0e40b5b50365c'

foreach ($sampleUsersArray as $user)
    $mailer->sendEmail($user['name'], $user['email'], $user);

And here's the template:

Hello {{ name }}, <br/><br/>

Welcome to our super cool event of the year! Your email address is: {{ email }}
and your token is {{ token }}. <br/><br/>

-- Organizers
You can’t perform that action at this time.