wepesi / mailer
一个简单的PHP模块,用于帮助使用PHP的mail函数发送SMTP电子邮件
v0.1.3
2023-01-08 12:59 UTC
Requires
- php: >=7.4
- wepesi/optionsresolver: dev-master
- wepesi/validation: dev-master
This package is auto-updated.
Last update: 2024-09-11 20:26:49 UTC
README
一个简单的PHP模块,用于帮助使用PHP邮件模块发送电子邮件 注意:它应该在实时服务器上测试。从localhost尚未支持。
use Wepesi\Mailer\Email; use Wepesi\Mailer\smtpConfiguration; include_once __DIR__."/../vendor/autoload.php"; $smtpConfig = (new smtpConfiguration()) ->smtpServer("localhost") ->smtpPort(25) ->setUsername("you@example.com") ->setPassword("p@ssW0rd") ->organization("Wepesi") ->generate(); $email = new Email($smtpConfig); $email->from("me@example.com"); $email->to("you@example.com","wepesi"); $email->subject("Subject"); $email->text("Hello World"); $email->setBCC(["johndoe@example.com","janedoe@example.com"]); $email->setCC(["alfa@example.com","beta@example.com"]); $result = $email->send(); if(isset($result['exception'])){ var_dump("email not sent"); } var_dump($result);