ukorjidechi / send_mail
SwiftMailer 封装器
0.1.2
2017-09-26 21:29 UTC
Requires
- php: >=7.0.0
- swiftmailer/swiftmailer: ^6.0
This package is auto-updated.
Last update: 2024-09-29 05:07:55 UTC
README
关于
send_mail 是一个基于 SwiftMailer 的简单脚本,它使从 PHP 应用程序发送电子邮件变得轻松。
安装
注意,安装 send_mail 也会安装 SwiftMailer 版本(^6.0) 及其所有依赖。
composer require "ukorjidechi/send_mail:^0.1"
- 在
send_mail.php中更改 用户名 和 密码 属性(该文件有良好的注释,便于配置)。
示例
<?php require __DIR__."/path/to/vendor/autoload.php"; try { $sender_email_addr = "sender@example.com"; $sender_name = "Sender Name"; $recipient_email_addr = "recipient@example.com"; $recipient_name = "Recipient Name"; $subject = "Email Subject"; $html_message = "<h2>This is the HTML part of the email message</h2>"; $plain_message = "This is the plain part of the email message"; (new \ukorJidechi\mail\send_mail( $sender_email_addr, $sender_name, $recipient_email_addr, $recipient_name, $subject, $html_message, $plain_message )); }catch(Exception $exception) { echo $exception->getMessage() ."<br><br>". $exception->getCode(). "<br><br>".$exception->getTraceAsString(); } ?>
快乐编码。