PHP code example of rareloop / lumberjack-email

1. Go to this page and download the library: Download rareloop/lumberjack-email 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/ */

    

rareloop / lumberjack-email example snippets


'providers' => [
    ...

    Rareloop\Lumberjack\Email\EmailServiceProvider::class,

    ...
],

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendHTML(
    '[email protected]',
    'Email Subject line',
    '<p>Email body goes here</p>'
);

// Or with a reply-to email
Email::sendHTML(
    '[email protected]',
    'Email Subject line',
    '<p>Email body goes here</p>',
    '[email protected]'
);

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendHTMLFromTemplate(
    '[email protected]',
    'Email Subject line',
    'email.twig',
    [ 'name' => 'Jane Doe' ] // Twig context
);

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendPlain(
    '[email protected]',
    'Email Subject line',
    'Plain text body',
);

use Rareloop\Lumberjack\Email\Facades\Email;

Email::sendPlain(
    '[email protected]',
    'Email Subject line',
    'Plain text body',
    false,  // Set reply-to to false if you don't need it, necessary because attachments is the final argument
    ['/path/to/file.pdf']
);

return [
    'smtp' => [
        'hostname' => '',
        'username' => '',
        'password' => '',
        'auth' => true|false,
        'port' => '',
    ],
];