PHP code example of kaadon / phpmailer
1. Go to this page and download the library: Download kaadon/phpmailer library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kaadon / phpmailer example snippets
> > //在config/kaadon中添加如下配置
> > "phpmailer" => [
> > "gmail" => [
> > "username" => "",
> > "password" => ""
> > ]
> > ]
> > // thinkphp中使用 Kaadon\PhpMailer\think\ThinkGmail 类
> > // 增加了 sendTemplateVerificationCode 发送方法,使用数据见 example
> >
> $GM = (new \Kaadon\PhpMailer\GmailSender([
> "username" => "[email protected] ",
> "password" => ""
> ]));
> $GM->setTo("[email protected] ")->setText("123456")->Send();
>
> $context = [
> "server" => [
> "member" => "[email protected] ",
> "time" => date("Y-m-d H:i:s"),
> "node" => "韩国",
> "ip" => "103.86.47.17",
> "payment_method" => "按月支付",
> "payment_price" => "US$29",
> ]
> ];
> $GM = (new \Kaadon\PhpMailer\GmailSender([
> "username" => "[email protected] ",
> "password" => ""//密码
> ]));
> $GM->setTo("[email protected] ")
> ->setSubject("服务续费通知")
> ->setTwigTemplates("/Volumes/SourceData/composer/phpmailer/twig_templates","product.html",$context)
> ->Send()
>