mrpck/email

电子邮件类库是围绕 SmtpClient 的高级别封装。

1.0.3 2021-05-03 10:18 UTC

This package is auto-updated.

Last update: 2024-09-29 05:49:52 UTC


README

电子邮件类库是围绕 SmtpClient 的高级别封装。

安装

src/ 目录下的文件复制到您的程序中

或者

composer require mrpck/email 1.0.0

用法

use Mrpck\Email\Email;

$mail = (new Email())
    ->from('hello@example.com')
    ->to('you@example.com')
    ->cc('cc@example.com')
    //->bcc('bcc@example.com')
    //->replyTo('fabien@example.com')
    //->priority(Email::PRIORITY_HIGH)
    ->subject('Time for PHP Mailer!')
	//->attach(file_get_contents('test.pdf'), 'test.pdf')
	//->text('Sending emails is fun again!')
    ->html('<p>See Twig integration for better HTML integration!</p>');

if(!$mail->Send()) {
	echo 'Message could not be sent.';
	echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
	echo 'Message has been sent';
}