$Mail_content = '请访问此链接:<a href="' . $site_url . "user/resetpwd_do.php?code=" . $code . "&uid=" . $uid . '">申请重置密码</a><br />如果不能打开,请复制下面网址到浏览器的地址栏粘贴并按回车!<br />' . $site_url . 'user/resetpwd_do.php?code=' . $code . '&uid=' . $uid; //判断邮件服务 if ($Selectmailservice == "mail-smtp") { //mail-smtp require '../lib/Ss/Etc/MailSmtp.php'; $mail = new \Ss\Etc\MailSmtp(); //判断smtp服务器连接方式 if ($mail_smtp_Connection == "1") { $mail->setServer($mail_smtp_Server, $mail_smtp_Account, $mail_smtp_password, $mail_smtp_Port, true); } else { $mail->setServer($mail_smtp_Server, $mail_smtp_Account, $mail_smtp_password); } //设置发件人 $mail->setFrom($mail_smtp_Account); //设置收件人,多个收件人,调用多次 $mail->setReceiver($email); //添加附件,多个附件,调用多次 //$mail->addAttachment("XXXX"); //设置邮件主题、内容 支持发送纯文本邮件和HTML格式的邮件 $mail->setMail($Mail_title, $Mail_content); //发送 $mail->sendMail(); } else { //mailgun require '../vendor/autoload.php'; $mg = new Mailgun($mailgun_key); $domain = $mailgun_domain; //send # Now, compose and send your message. $mg->sendMessage($domain, array('from' => "no-reply@" . $mailgun_domain, 'to' => $email, 'subject' => $Mail_title, 'html' => $Mail_content)); }
$mg->setServer($mail_smtp_Server, $mail_smtp_Account, $mail_smtp_password, $mail_smtp_Port, true); } else { $mg->setServer($mail_smtp_Server, $mail_smtp_Account, $mail_smtp_password, $mail_smtp_Port, false); } $mg->setFrom($mail_smtp_Account); $email = $_GET['email']; $c = new \Ss\User\UserCheck(); $q = new \Ss\User\Query(); $a = []; if ($c->IsEmailUsed($email)) { $uid = $q->GetUidByEmail($email); $rst = new \Ss\User\ResetPwd($uid); if ($rst->IsAbleToReset()) { $code = $rst->NewLog(); //send # Now, compose and send your message. $mg->setReceiver($email); $mg->setMail('重置密码', '请访问此链接申请重置密码' . $site_url . "/user/resetpwd_do.php?code=" . $code . "&uid=" . $uid); $mg->sendMail(); $a['code'] = '1'; $a['ok'] = '1'; $a['msg'] = "已经发送到邮箱"; } else { $a['code'] = '1'; $a['msg'] = "24小时内申请超过上限"; } } else { $a['code'] = '0'; $a['msg'] = "邮箱不存在"; } echo json_encode($a);
<?php //设置编码 header("content-type:text/html;charset=utf-8"); error_reporting(E_ALL); ini_set('display_errors', '1'); require_once 'config.php'; require_once 'Ss/Etc/MailSmtp.php'; /* echo "smtp服务器连接方式:". $mail_smtp_Connection."<br />"; echo "smtp服务器端口:".$mail_smtp_Port."<br />"; echo "smtp服务器:".$mail_smtp_Server."<br />"; echo "邮件帐号:".$mail_smtp_Account."<br />"; echo "邮件密码:".$mail_smtp_password."<br />"; */ $mail = new \Ss\Etc\MailSmtp(); if ($mail_smtp_Connection == "1") { $mail->setServer($mail_smtp_Server, $mail_smtp_Account, $mail_smtp_password, $mail_smtp_Port, true); } else { $mail->setServer($mail_smtp_Server, $mail_smtp_Account, $mail_smtp_password); } $mail->setFrom($mail_smtp_Account); //设置发件人 $mail->setReceiver("*****@*****.**"); //设置收件人,多个收件人,调用多次 //$mail->addAttachment("XXXX"); //添加附件,多个附件,调用多次 $mail->setMail("test主题", "test内容"); //设置邮件主题、内容 支持发送纯文本邮件和HTML格式的邮件 $mail->sendMail(); //发送