PHP code example of ome-tronet / laravel-frontapp-mailer

1. Go to this page and download the library: Download ome-tronet/laravel-frontapp-mailer 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/ */

    

ome-tronet / laravel-frontapp-mailer example snippets


return [
    'transport' => 'front',
    'api_base_url' => 'https://api2.frontapp.com',
    'api_token' => env('FRONTAPP_API_TOKEN'),
    'senders' => [

        /*
         * You must specify all desired senders.
         *
         * Specify shared inboxes as senders
         * with their channel_id.
         *
         */

         '[email protected]' => [
            'channel_id' => 'cha_XXXXX'
         ]

        /*
         * Specify teammates as senders
         * with their author_id.
         * You can use non-existing addresses.
         *
         * '[email protected]' => [
         *      'channel_id' => 'cha_XXXXX',
         *      'author_id' => 'tea_XXXXX'
         * ]
         *
         */

    ]
];

class MyMail extends Mailable
{
    // [...]
    
    public function envelope(): Envelope
    {
        return new Envelope(
            from: new Address('[email protected]'), // must be configured in frontapp-mailer.php
            subject: 'your_subject',
            tags: ['tag_XXXXX'],
        );
    }
    
    // [...]
}

use Illuminate\Support\Facades\Mail;

        Mail::mailer('front')
            ->to(['your_recipient']) 
            ->cc(['your_cc_recipient'])
            ->bcc(['your_bcc_recipient'])
            ->send(new MyMail());
bash
 php artisan vendor:publish --provider="tronet\FrontappMailer\FrontappServiceProvider"