PHP code example of longkyanh / laravel-optivo

1. Go to this page and download the library: Download longkyanh/laravel-optivo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

longkyanh / laravel-optivo example snippets


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 = '[email protected]';
        $data = [
            'firstname' => time(),
            'lastname' => time(),
            'age' => time(),
            'message' => time(),            
        ];
        $temp = $this->mailer->send($mailingListName, $locale, $recipient, $data);

        return new Response($temp);
    }
}