PHP code example of iflow / emailer

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

    

iflow / emailer example snippets


use iflow\EMailer\implement\Message\Html;
use iflow\EMailer\Mailer;

$config = [
    'default' => 'qqMailer',
    'emails' => [
        'mailer' => [
            'userName' => 'localhost',
            'passWord' => 'pwd',
            'fromName' => 'localhost:',
            'from' => 'root',
            'ssl' => true,
            'smtpHost' => 'smtp.exmail.domain.com',
            'smtpPort' => 465,
            'timeOut' => 1,
            'mimeVersion' => '1.0',
            'options' => [
                'open_eof_check' => true,
                'package_eof' => "\r\n",
                'package_max_length' => 65536
            ]
        ]
    ]
];

$mail = new Mailer($config, 'mailer');

$content = new Html();
$content = $content
    -> setHtml("<h1>测试邮件</h1> <strong>带附件</strong>")
    -> addAttachment('filename', 'filepath', encoded: 'base64')
    -> setSubject("测试邮件");