function mail_subscribe($city, $team, $partner, $subscribe) { global $INI; $week = array('日', '一', '二', '三', '四', '五', '六'); $today = date('Y年n月j日 星期') . $week[date('w')]; $vars = array('today' => $today, 'team' => $team, 'city' => $city, 'subscribe' => $subscribe, 'partner' => $partner, 'help_email' => $INI['subscribe']['helpemail'], 'help_mobile' => $INI['subscribe']['helpphone'], 'notice_email' => $INI['mail']['reply']); $message = render('mail_subscribe_team', $vars); $options = array('contentType' => 'text/html', 'encoding' => 'UTF-8'); $from = $INI['mail']['from']; $to = $subscribe['email']; $subject = $INI['system']['sitename'] . "今日团购:{$team['title']}"; if ($INI['mail']['mail'] == 'mail') { Mailer::SendMail($from, $to, $subject, $message, $options); } else { Mailer::SmtpMail($from, $to, $subject, $message, $options); } }
public function submit_audit() { $data = $_POST; $data['update_user_id'] = $this->login_user['id']; $data['audit_time'] = $data['update_time'] = date('Y-m-d H:i:s'); $audit_id = D('UserAudits')->saveOrUpdate($data); // 更新状态,待定的时候不更新状态 $up['id'] = $data['user_id']; $up['update_time'] = date('Y-m-d H:i:s'); if ($data['audit_result'] < 3) { if ($data['audit_result'] == 2) { // 失败 $up['status'] = 100; $up['fail_via_status'] = $data['status']; // $up['status_note'] = str_replace('待','',$this->user_statuses[$data['status']]) . '失败'; } else { $f['id'] = $data['status']; $up['status'] = M("UserStatuses")->where($f)->getField('success_to'); } D('UserRecommends')->saveOrUpdate($up); } if ($data['audit_result'] == 4) { $up['editable'] = 1; D('UserRecommends')->saveOrUpdate($up); } $msg = '提交成功'; if ($this->user_statuses[$up['status']]) { $msg .= ',' . $this->user_statuses[$up['status']]; } $userinfo = D("UserRecommends")->getRecommend($data['user_id']); $email_status_map = array(1 => 'success', 2 => 'fail', 4 => 'neededit'); $mail_info = D("UserStatuses")->getById($data['status']); $mailto = $userinfo[$mail_info[$email_status_map[$data['audit_result']] . '_email_to']]; $subject = $mail_info[$email_status_map[$data['audit_result']] . '_email_subject']; $body = $mail_info[$email_status_map[$data['audit_result']] . '_email_body']; $body = str_replace(array('[#recommender_name#]', '[#name#]', '[#audit_content#]', '[#invite_code#]', 'img src="/uploads'), array($userinfo['recommender_name'], $userinfo['name'], nl2br($data['audit_content']), $userinfo['invite_code'], 'img src="' . D("Options")->getOption("webroot_apply") . '/uploads'), $body); // email notification 通知给 if ($mailto && $subject && $body) { $res = Mailer::SmtpMail(NULL, $mailto, $subject, $body, null, array('*****@*****.**')); if ($res) { $msg .= ',通知邮件已发送给:' . $mailto; $audit_up['id'] = $audit_id; $audit_up['audit_email'] = serialize(array('to' => $mailto, 'subject' => $subject, 'body' => $body)); M("UserAudits")->save($audit_up); } } Session::Set('success', $msg); // 告知下一个人和管理员邮箱 // $enable_notice_auditor = D("Options")->getOption('audit_email_enable_realtime_notice_auditor'); // if($enable_notice_auditor) { // $tos[] = $this->login_user['email']; // $default_to_email = D("Options")->getOption('audit_success_notify_email'); // if($default_to_email) $tos[] = $default_to_email; // if($data['audit_result']==1) { // $f['status'] = $data['status']; // $f['user_id'] = $data['user_id']; // $next_user = M("UserAudits")->where($f)->field('audit_user_id,audit_user_name')->find(); // if($next_user) { // $tos[] = M("Users")->where("id=%d",$next_user['audit_user_id'])->getField('email'); // } // } // $next_name = $next_user?$next_user['audit_user_name']:'未分配'; // $subject = '【面试通知】' . $this->audit_opinions[$data['audit_result']] // . ' - [申请人]' . $userinfo['name'] // . ' - [当前状态]' . $this->user_statuses[$up['status']?$up['status']:$data['status']] // . ' - [面试人]' . $this->login_user['realname'] // . ' - [下一位面试人]' . $next_name; // $body = '【评审意见】<br />' . nl2br($data['audit_content']); // $body .= '<p>点击查看详情:' . D("Options")->getOption("webroot_pm") . '/user/detail/' . $userinfo['id'] . '</p>'; // Mailer::SmtpMail(NULL, $tos, $subject, $body); // } D('AdminLogs')->saveLog('user_audit', $data, 'insert', $data['user_id']); $this->redirect('/user/detail/' . intval($this->_post('user_id'))); }
public function submit_contact() { $captcha = $this->_param("captcha"); $subscribe = $this->_param("subscribe"); if (!Utility::CaptchaCheck($captcha, true)) { Session::Set("error", L("captcha_error")); $this->display("error"); return; } $subscriberModel = M("Subscribers"); if ($subscriberModel->create()) { $intrest = $this->_param("intrest"); if ($intrest) { $subscriberModel->intrest = implode(",", $intrest); } $subscriberModel->create_time = time(); $id = $subscriberModel->add(); //send email $contact = $this->_param("contact"); if ($contact) { // $name = $this->_param("name"); //如果联系方式是邮箱,就给对方发一封邮件 if (is_email($contact)) { $email_content = D("Options")->getOption("reply_email_content" . $this->lang); $email_title = D("Options")->getOption("reply_email_title" . $this->lang); Mailer::SmtpMail(null, array($contact), $email_title, $email_content); } } if ($subscribe) { $title = L('subscribe_success'); } else { $title = L('submit_success'); } $this->assign('title', $title); $this->display("subscribe_success"); } }
function mail_gift($order, $user) { global $INI; $week = array('S', 'M', 'T', 'W', 'T', 'F', 'S'); $today = date('m.d.Y') . $week[date('w')]; $vars = array('today' => $today, 'user' => $user, 'order' => $order, 'help_email' => $INI['subscribe']['helpemail'], 'help_mobile' => $INI['subscribe']['helpphone'], 'notice_email' => $INI['mail']['reply']); $message = render('mail_gift_info', $vars); //$mesasge = mb_convert_encoding($mesage, 'GBK', 'UTF-8'); $options = array('contentType' => 'text/html', 'encoding' => 'UTF-8'); $from = $INI['mail']['from']; $to = $user['email']; $subject = $INI['system']['sitename'] . ": Your Gift Card Details"; if ($order['email']) { $to = $order['email']; $subject = "(Your gift from " . $order['from'] . ")" . $subject; } //$content=createpdf(render('mail_coupon_pdf',$vars)); if ($INI['mail']['mail'] == 'mail') { Mailer::SendMail($from, $to, $subject, $message, $options); } else { Mailer::SmtpMail($from, $to, $subject, $message, $options); //,null,$content); } }
function mail_subscribemulti($teams,$subscribe) { global $INI; $encoding = $INI['mail']['encoding'] ? $INI['mail']['encoding'] : 'UTF-8'; $week = array('日','一','二','三','四','五','六'); $today = date('Y年n月j日 星期') . $week[date('w')]; $first = array_shift($teams); $vars = array( 'today' => $today, 'first' => $first, 'teams' => $teams, 'subscribe' => $subscribe, 'help_email' => $INI['mail']['helpemail'], 'help_mobile' => $INI['mail']['helpphone'], 'notice_email' => $INI['mail']['reply'], ); $message = render('mail_subscribe_multiteam', $vars); $options = array( 'contentType' => 'text/html', 'encoding' => $encoding, ); $from = $INI['mail']['from']; $to = $subscribe['email']; $subject = "夏天你不得不了解避暑大法,看看这些明星是怎么避暑的?"; if ($INI['mail']['mail']=='mail') { Mailer::SendMail($from, $to, $subject, $message, $options); } else { Mailer::SmtpMail($from, $to, $subject, $message, $options); } }
public function submit_forget_password() { $email = $this->_param("email"); if (!Utility::CaptchaCheck($this->_post('verifycode'))) { Session::Set("error", "验证码有误,请重新输入"); redirect("/register/forget_password"); } if ($email) { $user = D("CmsUsers")->where(array("email" => $email))->find(); if ($user) { $subject = D("Options")->getOption("verify_email_subject"); $repasscode = md5(generate_password()); D("CmsUsers")->where(array('id' => $user['id']))->setField("repasscode", $repasscode); $link = D("Options")->getOption("webroot_apply") . "/register/verify_repass?id=" . Crypt::en($user['id']) . "&repasscode={$repasscode}"; $link = "<a href='{$link}'>" . $link . "</a>"; $subject = D("Options")->getOption("repass_email_subject"); $content = D("Options")->getOption("repass_email_content"); $content = str_replace("[#link#]", $link, $content); Mailer::SmtpMail(null, $email, $subject, $content); redirect("/register/submit_forget_password_result?token=" . Crypt::en($email)); } else { Session::Set("error", "无此邮箱"); redirect("/register/forget_password"); } } else { Session::Set("error", "无此邮箱"); redirect("/register/forget_password"); } }
public function submit_recommend() { $f['id'] = $id = intval(I("id")); $f['recommend_user_id'] = $this->login_user['id']; $recommend = D("UserRecommends")->where($f)->find(); if (!$recommend) { session('error', '参数有误'); } $recommend_question_answers = D(PM_NAME . "://UserQuestionAnswers")->getByUserId($id, 1, '_question_'); foreach ($this->recommend_items as $key => $value) { if (!$value['param']['require']) { continue; } if (strpos($key, 'userinfo_') === 0 && trim($this->user_info[substr($key, 9)]) == "") { $alert_items[] = $value['display']; $project_alert_item_keys[] = $key; } if (strpos($key, 'userinfo_') === false && trim($recommend[$key]) == "") { $alert_items[] = $value['display']; $project_alert_item_keys[] = $key; } } $idx = 0; foreach ($this->recommend_questions as $k => $v) { $idx++; if (!$v['param']['require']) { continue; } if (!trim($recommend_question_answers[$k])) { $alert_items[] = '问答题' . $idx; $project_alert_item_keys[] = $k; } } if ($alert_items) { Session::set('error', "提交时,以下字段不能为空:" . implode(',', $alert_items)); Session::set('project_alert_item_keys', implode(",", $project_alert_item_keys)); redirect('/userinfo/edit_recommend?id=' . $id); } $u['id'] = $recommend['id']; $u['editable'] = 0; $province = $recommend['address_province']; //如果当前被推荐人省份为空,那么设置为未知省份 if ($province === "") { $province = "未知"; $u['address_province'] = "未知"; } $u['identifier'] = createIdentifier($province); $u['recommend_submit_time'] = date('Y-m-d H:i:s'); if ($recommend['status'] == 1) { $u['status'] = 30; } $u['invite_code'] = D('UserRecommends')->genInviteCode(); D("UserRecommends")->save($u); Session::Set("success", "提交成功,感谢您的推荐,我们会尽快查看您的提交并及时回复"); // 发邮件给项目负责人 $title = '【' . D('Options')->getOption('site_name') . '】新推荐' . $title_key . $recommend['name']; $content = "推荐链接:" . D('Options')->getOption('webroot_pm') . '/user/detail/' . $recommend['id']; Mailer::SmtpMail(null, D('Options')->getOption('contact_email'), $title, $content); //发邮件给推荐人 $title = D('UserStatuses')->where("id=20")->getField("success_email_subject"); $content = D('UserStatuses')->where("id=20")->getField("success_email_body"); $content = str_replace("[#recommender_name#]", D('UserInfo')->where("id=" . $this->login_user['id'])->getField("name"), $content); $content = str_replace("[#name#]", $recommend['name'], $content); $mailto = D('CmsUsers')->where("id=" . $this->login_user['id'])->getField("email"); Mailer::SmtpMail(null, $mailto, $title, $content); redirect("/userinfo/index"); }