Skip to content

lstables/Laravel-Mailer-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

Laravel Mailer Class

A simple Laravel mailer class

You can use this as you wish, just a simple class to help cleanup code and send mail.

The best way to use is either type-hint from your method:

public function store(AppMailer $mailer)
{
  // Do some stuff
  // pass the user object through, do whatever you want here
  
  // Send email
  $mailer->sendEmailConfirmationTo($user);
  return back(); // Whatever you like
}

or via your constructor method like so and I store in app/Mailers

use App\Mailers\AppMailer;

 /**
 * @var AppMailer
 */
private $mailer;

/**
 * constructor.
 * @param AppMailer $mailer
 */
public function __construct(AppMailer $mailer)
{
    $this->mailer = $mailer;
}

Then just refer to $this->mailer->sendEmailConfirmationTo() or whatever methods you have within the mailer class.

About

A simple Laravel mailer class

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages