PHP code example of qingbing / pf-tools-mail

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

    

qingbing / pf-tools-mail example snippets


return [
    'mail_addr' => 'PhpCorner<[email protected]>',
    'mail_pass' => 'xxxxxx',
];

$to = '[email protected]';
$subject = 'phpcorner.net 邮件测试';
$body = '测试 phpcorner.net 邮件';
$cc = '[email protected]';
$bcc = '[email protected]';
$mail = \Tools\Email::getInstance(Config::getInstance('email')->getAll());
$status = $mail->sendMail($to, $subject, $body, $cc, $bcc);
if ($status) {
    echo 'success';
} else {
    var_dump($mail->getErrors());
}