PHP code example of timfeid / slack-laravel-mail

1. Go to this page and download the library: Download timfeid/slack-laravel-mail 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/ */

    

timfeid / slack-laravel-mail example snippets


    TimFeid\SlackLaravelMail\SlackMailServiceProvider::class,

    'slackmail' => [
        // The endpoint to your webhook
        'endpoint' => env('SLACKMAIL_ENDPOINT', 'https://hooks.slack.com/services/..../....'),
        // The driver for which you would like to store emails
        // Drivers are 'cache' and 'file' for now
        'driver' => env('SLACKMAIL_DRIVER', 'cache'),
        // Cache settings, will always use your default cache driver for now
        'cache' => [
            // Remove if you would not like to use cache()->tags()
            'tag' => 'slack-mail',
            // Time you want to keep emails for in minutes
            'ttl' => 60,
        ],
        'file' => [
            // File location you would like to save your emails
            'location' => storage_path('/mail'),
        ],
        // From user for your Slack message
        'from' => 'Emails',
        // Channel you'd like to send your messages to
        // @username to send private messages from @Slackbot
        'channel' => env('SLACKMAIL_TO', '#emails'),
        // Fields you would like to show up in your message
        'fields' => [
            'subject',
            'to',
            'cc',
            'bcc',
            'from',
            'attachments',
        ],
    ],

    if (!app()->environment('production')) {
        Route::get('/slack-mail/{name}', '\TimFeid\SlackLaravelMail\Controllers\SlackMailController@slackMail')
            ->name('slackmail');
    }



namespace App\Providers;

use App\Services\Slack\SlackFields;
use TimFeid\SlackLaravelMail\SlackMailServiceProvider as BaseProvider;

class SlackMailServiceProvider extends BaseProvider
{
    public function registerSlackFields()
    {
        $this->app->singleton('slackmail.fields', SlackFields::class);
    }
}




namespace App\Services\Slack;

use TimFeid\SlackLaravelMail\SlackFields as BaseSlackFields;

class SlackFields extends BaseSlackFields
{
    public function buildSendgridField()
    {
        return [
            'title' => 'Sendgrid Headers',
            'value' => '