| Package Data | |
|---|---|
| Maintainer Username: | erickkur | 
| Maintainer Contact: | bobbysutriadi@gmail.com (Bobby Sutriadi) | 
| Package Create Date: | 2017-01-09 | 
| Package Last Update: | 2017-01-16 | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-26 03:14:05 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 30 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 0 | 
| Total Watchers: | 0 | 
| Total Forks: | 0 | 
| Total Open Issues: | 0 | 
#laravel-emailer
laravel-emailer add a way to
"bronanza/laravel-emailer": "dev-master"
public function register()
{
    $this->app->singleton(
        'Bronanza\Emailer\Contracts\Emailer',
        'Bronanza\Emailer\LaravelEmailer'
    );
}
<?php
namespace App\Http\Controllers;
use Illuminate\Mail\Message;
use Bronanza\Emailer\Contracts\Email;
use App\User;
class UserEmail implements Email
{
    /**
     * Show the profile for the given user.
     *
     * @param  int  $id
     * @return Response
     */
    public function __construct(User $user)
    {
        $this->user = $user;
    }
    // View that will be used for the email
    public function template()
    {
        return 'email.email-test';
    }
    // Data that will be used in the view
    public function templateData()
    {
        return [
            'user' => $this->user,
        ];
    }
    public function setup()
    {
        return function (Message $message) {
            $customerSupport = [
                'email' => 'apeng@example.com',
                'name' => 'apeng'
            ];
            $subject = 'Test Sending Email';
            return $message
                ->from($customerSupport['email'], $customerSupport['name'])
                ->to($this->user->email, $this->user->first_name)
                ->bcc($customerSupport['email'])
                ->subject($subject);
        };
    }
}
<?php
namespace App\Http\Controllers;
use App;
use App\User;
use App\Http\Controllers\Controller;
use Bronanza\Emailer\Contracts\Emailer;
use App\Http\Http\Controller\UserEmail;
class SendEmail
{
    protected $emailer;
    /** 
    *    instantite the emailer interface
    **/
    public function __construct(Emailer $emailer)
    {
        $this->emailer = $emailer;
    }
    public function index()
    {
        // Create a new Email object that contains the configuration
        $email = App::make('App\Http\Controllers\UserEmail');
        // Send the email
        $this->emailer->send($email);
    }
}