pushkar/easy-mail

一个用于封装php的mail函数的包装器,允许您轻松构建和发送邮件。

v1.5.4 2020-03-19 20:26 UTC

README

一个用于封装php的mail函数的包装器,允许您轻松构建和发送邮件。

安装

使用composer

composer require pushkar/easy-mail

用法

require_once "../../path/to/vendor/autoload.php";

use EasyMail\Mail;

//Example 1

$mail = new Mail("send_to@exapmle.com");
$mail->setSubject("Subject");
$mail->setMsg("Msg");
if($mail->sendMail()) {
    echo "Mail Sent.";
}

//Example 2

$mail = new Mail("send_to@exapmle.com", "Subject", "Msg');
if($mail->sendMail()) {
    echo "Mail Sent.";
}

//Some methods

//For a reply-to header
$mail->addReplyTo("email@email.com", Name);

//For html email
$mail->isHtml(true);

//For adding custom header
$mail->customHeaders($header);

//set From
$mail->setFrom($email, $name);

//All methods
isValidEmail(string);
isHtml(bool);
setSubject(string);
setMsg(string);
addCC(string);
addBcc(string);
customHeader(string);
addReplyTo(string, string|null);
setFrom(string, string|null);
setPriority(int);
addAttachment(string);
setEncoding(string);
sendMail();

许可证

版权(c)2018 Pushkar Anand。在MIT许可证下。