2017 © Pedro Peláez
 

library sunmailer

SunMailer helps you to send email easily.

image

sun/sunmailer

SunMailer helps you to send email easily.

  • Monday, September 7, 2015
  • by IftekherSunny
  • Repository
  • 2 Watchers
  • 3 Stars
  • 82 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

SunMailer

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

SunMailer helps you to send email easily., (*2)

Installation Process

Just copy SunMailer folder somewhere into your project directory. Then include SunMailer autoloader., (*3)

  require_once('/path/to/SunMailer/autoload.php');

SunMailer is also available via Composer/Packagist., (*4)

  composer require sun/sunmailer

Configuration

Open config.php file located at SunMailer/config.php then,, (*5)

Setup your SMTP Server ( Default set to Gmail SMTP ), (*6)

'host'           => 'smtp.gmail.com',
'port'           =>  465,
'encryption'     => 'ssl',

Setup your username and password:, (*7)

'username'      => 'example@gmail.com',
'password'      => 'secret',

You can also add your “from” and “reply” which will include email & name., (*8)

'from'  => [ 'email' => 'admin@example.com', 'name' => 'Administrator' ],
'reply' => [ 'email' => 'contact@example.com', 'name' => 'Information' ],

Setup your email view directory. If you do not add any path of the view directory then it's pointing your root directory., (*9)

'view-directory'  => 'app/view'

If you want to test your email locally just set log to true. ( Default set to false ), (*10)

'log'   => false

Send basic email

// namespace
use SunMailer\Mailer;
use SunMailer\View;
use SunMailer\MailerException;


$email      =   'example@gmail.com';
$name       =   'Test mail name';
$subject    =   'Test mail subject';
$body       =   'Test mail body';


try
{
    if(Mailer::send($email, $name, $subject, $body))
    {
        echo 'Email has been sent successfully.';
    }
}
catch (MailerException $e)
{
    echo  'Oops!!! Something goes to wrong. '. $e->getMessage();
}

Email with attached file

$attached   =   'images/sunmailer.jpg';

if(Mailer::send($email, $name, $subject, $body, $attached))
{
    echo 'Email has been sent successfully.';
}

Send email using view render

render() method of the View class helps you to render HTML outlook., (*11)

View::render('to.path.test');

For pointing your file path use ( . ) or ( / ) , and add your file name without (.php) extension., (*12)

$body = View::render('email.test');

if(Mailer::send($email, $name, $subject, $body))
{
    echo 'Email has been sent successfully.';
}

You can also pass any value to the view template by the second parameter of the render() method (Default set to null)., (*13)

$data  = [ 'name'  =>  'Test Name' ];
View::render('email.test', $data);

You need to add a placeholder ( added @ at the begining of your variable name ) for getting this data into view template. For the above an example is given below., (*14)

@name

To clean log directory

Mailer::logClean();

Some of helper functions

// to get configuration file
Helper::config();

// to get root directory path
Helper::root_path();

// to get log directory path
Helper::log_path();

// to get temp directory path
Helper::temp_path();

License

This package is licensed under the MIT License, (*15)

The Versions

07/09 2015

dev-master

9999999-dev

SunMailer helps you to send email easily.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mail email php mailer phpmailer php mailer

07/09 2015

v1.4

1.4.0.0

SunMailer helps you to send email easily.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mail email php mailer phpmailer php mailer

25/07 2015

v1.3

1.3.0.0

SunMailer helps you to send email easily.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mail email php mailer phpmailer php mailer

21/07 2015

v1.2

1.2.0.0

SunMailer helps you to send email easily.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mail email php mailer phpmailer php mailer

13/07 2015

v1.1

1.1.0.0

SunMailer helps you to send email easily.

  Sources   Download

MIT

The Requires

 

The Development Requires

13/07 2015

v1.0

1.0.0.0

SunMailer helps you to send email easily.

  Sources   Download

MIT

The Requires

 

The Development Requires