PHP code example of phpauth / phpauth.mailer.phpmailer

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

    

phpauth / phpauth.mailer.phpmailer example snippets


$config = new \PHPAuth\Config($pdo);

$config->setMailer(new \PHPAuth\Mailer\PHPMailerDriver([
    'debug'     =>  true,

    'auth'      =>  true,
    'username'  =>  '[email protected]',
    'password'  =>  'your-password',
    
    'secure'    =>  \PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS, // 'tls'
    // OR
    'secure'    =>  \PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS,   // 'ssl'
    
    'host'      =>  'smtp.gmail.com',
    'port'      =>  587, // relative to security type 

    // setFrom
    'site_email'    => '[email protected]',
    'site_name'     => 'Your Site'
]));

$auth = new \PHPAuth\Auth($pdo, $config);