沙拉酱 / 邮件发送器
沙拉堆邮件发送扩展
1.1.0
2024-09-10 00:53 UTC
Requires
- phpmailer/phpmailer: ^6.9
README
SaladStack 扩展,用于使用 PHPMailer 发送邮件
安装方法
composer require salad-dressing/mailer
更新方法
composer update salad-dressing/mailer
快照
发送普通邮件
use Salad\Dressing\Mailer\Sender; public function index() { $this->sender = new Sender; $this->sender->addRecipient("test@saladstack.com"); $this->sender->setSubject("SaladStack Email Test"); $this->sender->setBody("This is a test email."); if($this->sender->send()){ echo "Email Sent!"; } else { echo "Sending failed."; } }
发送 HTML 格式邮件正文
use Salad\Dressing\Mailer\Sender; public function index() { $this->sender = new Sender; $this->sender->addRecipient("test@saladstack.com"); $this->sender->setSubject("SaladStack Email Test"); //adding true on the 2nd params will enable html body $this->sender->setBody("<h1>This is a test email.</h1>", true); if($this->sender->send()){ echo "Email Sent!"; } else { echo "Sending failed."; } }