sses-tokyo/php-mailer-smtp-wrapper

PHPMailer SMTP 包装器

1.0.3 2017-10-05 14:56 UTC

This package is not auto-updated.

Last update: 2024-09-28 01:28:00 UTC


README

描述

这是 SMTP 的 PHPMailer 包装器。

安装与加载

PHPMailerSMTPWrapper 可在 Packagist 上找到(使用语义版本控制),推荐使用 composer 进行安装。只需将此行添加到您的 composer.json 文件中

"sses-tokyo/php-mailer-smtp-wrapper": "^1.0"

或者运行

composer require sses-tokyo/php-mailer-smtp-wrapper

简单示例

<?php
require 'vendor/autoload.php';

use SSESTokyo\PHPMailerSMTPWrapper\PHPMailerSMTPWrapper;

$debug    = 0;
$secure   = 'tls';
$host     = 'example.com';
$port     = '587';
$user     = 'test@example.com';
$password = '***';
$mail = new PHPMailerSMTPWrapper($debug, $secure, $host, $port, $user, $password);

$to = 'test@example.com';
$subject = 'PHPMailerSMTPWrapper';
$body = 'This is a test mail.';
$fromname = $user;
$fromaddress = $user;
$res = $mail->send($to, $subject, $body, $fromname, $fromaddress);
echo $res;