PHP code example of abiodun / mailswifter

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

    

abiodun / mailswifter example snippets


    $mail_provider = new MailProvider([
        'username' => '[email protected]',
        'password' => 'password',
        'smtp' => 'smtp.gmail.com',
    ]);

    $mail_provider->from = ['[email protected]' => 'Testing MailSwifter'];
    $mail_provider->to = ['[email protected]', '[email protected]' => 'Mailing'];

    $mail_provider->subject = 'New Mail Test';

    $file = __DIR__ . '/sample.html';
    $data_list = [
        'name' => ' ',
        'url' => 'http://info.google.com',
        'category' => 'Fashion',
    ];
    $resp = $mail_provider->template($file, $data_list);
    $resp = $mail_provider->send();