PHP code example of bailangzhan / yii2-swiftmailer

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

    

bailangzhan / yii2-swiftmailer example snippets


use bailangzhan\Mailer;
$message = [
    'to' => '要发送给谁',
    'subject' => '邮件标题',
    'content' => '邮件内容',
];
$mailer = new Mailer(Mailer::TYPE_1, $messages);
$result = $mailer->sendMessage();

$message = [
    'to' => '要发送给谁',
    'subject' => '邮件标题',
    'view' => 'mail-template',
    'params' => [
        'name' => '白狼栈',
    ]
];

$messages = [
	[
		'to' => '要发送给谁',
		'subject' => '邮件标题',
		'content' => '邮件内容',
	],
	[
		'to' => '要发送给谁',
		'subject' => '邮件标题',
		'content' => '邮件内容',
		'view' => 'mail-template',
		'params' => [
			'name' => '白狼栈',
		]
	]
];
$mailer = new Mailer(Mailer::TYPE_2, $messages);
$result = $mailer->sendMessage();

$ php composer.phar