nguyentienlong / laravel-optivo by longnguyen

Optivo Mail Client for Laravel
20
0
2
Package Data
Maintainer Username: longnguyen
Maintainer Contact: nguyentienlong88@gmail.com (long nguyen)
Package Create Date: 2016-02-21
Package Last Update: 2016-02-28
Home Page: http://longkyanh.info
Language: PHP
License: MIT
Last Refreshed: 2024-04-30 15:11:17
Package Statistics
Total Downloads: 20
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

laravel-optivo

Optivo mailer for Laravel ( >= v5 ).

Usage:

  • composer require longkyanh/laravel-optivo

  • Dependency injection

use Longkyanh\Mailer\Optivo as Mailer;

class TestEmailController extends Controller
{
    protected $mailer;

    public function __construct(Mailer $mailer)
    {
        $this->mailer = $mailer; // auto resolve by Laravel container
    }

    public function testEmail():Response
    {
        $mailingListName = 'a-test-mailing-list';
        $locale = 'en';
        $recipient = 'nguyentienlong88+1@gmail.com';
        $data = [
            'firstname' => time(),
            'lastname' => time(),
            'age' => time(),
            'message' => time(),            
        ];
        $temp = $this->mailer->send($mailingListName, $locale, $recipient, $data);

        return new Response($temp);
    }
}
  • Use with OptivoMailer Facade

    • Add this line below into config/app.php

      Longkyanh\Mailer\OptivoServiceProvider::class,

    • Then use in any class

      // before any class definition
      use Longkyanh\Mailer\OptivoMailer;
      
      // call send function anywhere you want
      OptivoMailer::send($mailingListName, $locale, $recipient, $data);