PHP code example of codeqasim / mailer

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

    

codeqasim / mailer example snippets




use CodeQasim\Mailer\Mailer;

$mailer = new Mailer();

$mailer->configure([
    'server' => 'smtp.gmail.com',
    'port' => 587,
    'security' => 'tls', // 'tls' or 'ssl'
    'username' => '[email protected]',
    'password' => 'your_email_password',
]);

$mailer->sendEmail([
    'from' => '[email protected]',
    'to' => '[email protected]',
    'subject' => 'Test Email',
    'template' => 'path/to/template.html', // Path to your template
    'variables' => [ // Variables for placeholders in the template
        'name' => 'John Doe',
        'date' => date('Y-m-d'),
    ],
]);