rafansilva / emailsender
一个简单的电子邮件发送库,它抽象了PHPMAILER的行为
1.0.1
2021-04-06 02:11 UTC
Requires
- php: ^7.1
- ext-curl: *
- ext-json: *
- phpmailer/phpmailer: v6.4.*
This package is not auto-updated.
Last update: 2024-10-01 18:56:03 UTC
README
EmailSender是一个类,它抽象了PhpMailer组件的行为,简化了通过SMTP发送电子邮件的过程。
EmailSender是一个类,它抽象了PHPMailer组件的行为,并简化了通过SMTP发送电子邮件的过程。
亮点
- 简单安装
- 简化初始设置
- 简单的方法发送电子邮件和附件
- Composer就绪且符合PSR-2规范
安装
通过Composer可以获取Uploader
"rafansilva/emailsender": "^1.0"
或者运行
composer require rafansilva/emailsender
文档
有关如何使用的信息,请查看组件目录中的示例文件夹。其中包含每个类的使用示例。它的工作方式如下
有关如何使用更详细的信息,请查看组件目录中的示例文件夹。在其中,您将找到一个类的使用示例。它的工作方式如下
设置发送电子邮件
<?php /** * TIP: Put these constants in your project's config file. */ define("CONF_MAIL_HOST", "smtp.example.com"); //Set the SMTP server to send through define("CONF_MAIL_PORT", 587); //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` define("CONF_MAIL_USER", "user@example.com"); //SMTP username define("CONF_MAIL_PASS", "password"); //SMTP password define("CONF_MAIL_SENDER", ["name" => "yourName", "address" => "your@email.com"]); //Change here the name and email of who will send the email define("CONF_MAIL_OPTION_DEBUG", 0); //To enable verbose debug output use 2 or 0 to disable define("CONF_MAIL_OPTION_LANG", "br"); //Your language define("CONF_MAIL_OPTION_HTML", true); //Set email format to HTML define("CONF_MAIL_OPTION_AUTH", true); //Enable SMTP authentication define("CONF_MAIL_OPTION_SECURE", "tls"); //Enable TLS encryption define("CONF_MAIL_OPTION_CHARSET", "utf-8"); //Default charset is utf-8
发送电子邮件和附件的示例
<?php require __DIR__ . '/../vendor/autoload.php'; use RafaNSilva\Support\Email; $mail = new Email(); $mail->bootstrap( "Example of sending email", "<h1>This is the HTML message body</h1>", "joe@example.net", "Joe User" )->send(); $mail->bootstrap( "Email with Attachments", "<p>See the attachment below</p>", "joe@example.net", "Joe User" )->attach(__DIR__ . "/image/joinha.jpg", "Joinha")->send();
贡献
有关详细信息,请参阅 CONTRIBUTING
支持
安全:如果您发现任何安全问题,请通过电子邮件 rafaelnascimento0505@gmail.com 而不是使用问题跟踪器。
如果您发现任何安全问题,请通过电子邮件 rafaelnascimento0505@gmail.com 而不是使用问题跟踪器。
谢谢
鸣谢
- Rafael N. Silva(开发者)
- 所有贡献者(此项目)
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。