function plugin_qhmpw_send_remind() { global $script, $vars, $admin_email; // 登録メールアドレスチェック if (trim($vars['qhmpw']['email']) != $admin_email) { $error = 'メールアドレスが登録されているものと異なります'; return plugin_qhmpw_form_remind($error); } // qhm.ini.php の qhm_pw_str を変更 require_once "./lib/Mcrypt.php"; $code = $_SESSION['qhmsetting']['qhm_pw_str'] = ORMcrypt::get_key(50); if (exist_plugin('qhmsetting')) { call_user_func('plugin_qhmsetting_update_ini'); } // メール送信 require_once "./lib/simplemail.php"; $smail = new SimpleMail(); $smail->set_params('', $admin_email); $smail->subject = 'パスワードの再発行'; $smail->to = array('name' => '', 'email' => $admin_email); $mailbody = ' パスワードの再発行をします。 下記のURLをクリックしてください。 ' . $script . '?cmd=qhmpw&code=' . $code . ' '; $smail->send($mailbody); $msg = 'パスワードの再発行:メールを送信しました'; $body = '登録メールアドレスにメールを送信しました。'; return array('msg' => $msg, 'body' => $body); }
function sent_qblog_comment_notice($page, $data) { global $script, $qblog_comment_check, $admin_email; global $qblog_title; $r_page = rawurlencode($page); //管理者メルアド必須 if (trim($admin_email) === '') { return FALSE; } require LIB_DIR . 'simplemail.php'; $smail = new SimpleMail(); $data['id'] = 'qbcomment_' . $data['id']; //for #hash $data['url'] = $script . '?' . $r_page; $data['body'] = $data['msg']; $data['datetime'] = date('Y年m月d日 H時i分s秒'); $ptns = $smail->mksearch($data); $rpls = $smail->mkreplace($data); $ptns[] = '<%header%>'; $rpls[] = 'ブログにコメントがありました'; $ptns[] = '<%footer%>'; $rpls[] = $qblog_comment_check ? 'よろしければ承認してください。' : ''; $ptns[] = '<%blog_title%>'; $rpls[] = $qblog_title; $subject_fmt = '[<%blog_title%>] ブログに新しいコメントがあります。'; $body_fmt = <<<EOM <%header%> ブログ名:<%blog_title%> 記事:<%url%> 日時: <%datetime%> お名前: <%name%> タイトル: <%title%> コメント: <%body%> <%footer%> ---- <%url%>#<%id%> EOM; //設定 $notifier = 'QHM'; $smail->set_params($notifier, $admin_email); $smail->set_to('', $admin_email); $smail->set_subject($subject_fmt); //管理者へ送信 $smail->replace_send($ptns, $rpls, $body_fmt); //TODO: お名前サーバーや、GoogleAppsへ対応 return TRUE; }
function plugin_qform_do_finish($params, $url_sanitize = '0') { global $vars, $script, $google_apps, $google_apps_domain, $pass; $qm = get_qm(); $page = $vars['page']; $conf = $params['conf']; $els = $params['element']; $search = array(); $udata = array(); //mk data $all = ''; $excludes = array_flip(array('email')); foreach ($els as $id => $v) { $tmp = isset($_SESSION['qform'][$id]) ? $_SESSION['qform'][$id] : ''; //住所だけ、特別扱い if ($id === 'address_zip') { $tmp = ''; foreach (array('address_zip', 'address_state', 'address_city', 'address_street') as $addname) { $udata[$addname] = isset($_SESSION['qform'][$addname]) ? $_SESSION['qform'][$addname] : ''; $search[$addname] = '<%' . $addname . '%>'; $tmp .= $_SESSION['qform'][$addname] . "\n"; } $tmp = substr($tmp, 0, -1); $id = 'address'; } else { if (preg_match('/^address_/', $id)) { continue; } } $data = is_array($tmp) ? implode(", ", $tmp) : $tmp; $udata[$id] = array_key_exists($id, $excludes) ? $data : plugin_qform_sanitize_url($data, $url_sanitize); $search[$id] = '<%' . $id . '%>'; //lname, fnameのとき用 if ($id == 'lname') { $all .= $v['label'] . ' : '; $all .= $udata['lname'] . ' ' . $_SESSION['qform']['fname'] . "\n"; } //lname_kana, fname_kanaのとき用 if ($id == 'lname_kana') { $all .= $v['label'] . ' : '; $all .= $udata['lname_kana'] . ' ' . $_SESSION['qform']['fname_kana'] . "\n"; } if ($id != 'fname' && $id != 'lname' && $id != 'fname_kana' && $id != 'lname_kana') { $all .= $v['label'] . ' : '; //addressの時だけ、ラベルの後に改行を入れる if ($id == 'address') { $all .= "\n"; } $all .= $udata[$id] . "\n"; } } $search['all_post_data'] = '<%all_post_data%>'; $udata['all_post_data'] = $all; $search['form_url'] = '<%form_url%>'; $udata['form_url'] = $script . '?' . rawurlencode($page); //mail送信 $smail = new SimpleMail(); // -------------------------------- // Auto Reply Mail (finish mail) // -------------------------------- if (isset($conf['finish_mail'])) { $subject = str_replace($search, $udata, $conf['finish_mail']['subject']); $mailbody = str_replace($search, $udata, $conf['finish_mail']['body']); //Google Appsを使って、更に自分宛の場合 if ($google_apps && preg_match('/.*@' . $google_apps_domain . '$/', $udata['email'])) { $mail =& new Qdmail(); $mail->smtp(true); $param = array('host' => 'ASPMX.L.GOOGLE.com', 'port' => 25, 'from' => $conf['finish_mail']['from']['email'], 'protocol' => 'SMTP', 'user' => 'root@' . $google_apps_domain, 'pass' => $passwd); $mail->smtpServer($param); $mail->to($udata['email']); $mail->subject($subject); $mail->from($conf['finish_mail']['from']['email']); $mail->text($mailbody); $retval = $mail->send(); } else { // 通常の送信 $smail->set_params($conf['finish_mail']['from']['name'], $conf['finish_mail']['from']['email']); $smail->subject = $subject; $smail->to = array('name' => '', 'email' => $udata['email']); $smail->send($mailbody); } } // ------------------------------- // notice mail // ------------------------------- if (isset($conf['notice_mail'])) { $subject = str_replace($search, $udata, $conf['notice_mail']['subject']); $mailbody = str_replace($search, $udata, $conf['notice_mail']['body']); // commu if (isset($_SESSION['commu_user'])) { // commu $domain = ini_get('session.cookie_domain'); // commu $path = ini_get('session.cookie_path'); // commu $url = (SERVER_PORT == 443) ? 'https://' : 'http://'; // commu $url .= $domain; // commu $url .= (SERVER_PORT == 80) ? '' : ':'.SERVER_PORT; // commu $url .= $path.'commu/admin_user_view.php?cid='.$_SESSION['commu_user']['id']; // commu $mailbody .= "\n\n----------------------------\n"; // commu $mailbody .= "ユーザーの詳細\n".$url."\n"; // commu } $to_name = $conf['notice_mail']['to']['name']; $to_email = $conf['notice_mail']['to']['email']; //Google Appsを使って、更に自分宛の場合 if ($google_apps && preg_match('/.*@' . $google_apps_domain . '$/', $to_email)) { $mail =& new Qdmail(); $mail->smtp(true); $param = array('host' => 'ASPMX.L.GOOGLE.com', 'port' => 25, 'from' => $udata['email'], 'protocol' => 'SMTP', 'user' => 'root@' . $google_apps_domain, 'pass' => $passwd); $mail->smtpServer($param); $mail->to($to_email); $mail->subject($subject); $mail->from($udata['email']); $mail->text($mailbody); //添付ファイル foreach ($_SESSION['qform']['_FILES'] as $f) { if (file_exists($f['path'])) { $mail->attach(array($f['path'], $f['name']), true); } } $retval = $mail->send(); } else { $name = isset($udata['lname']) ? $udata['lname'] : ''; $name .= isset($udata['fname']) ? $udata['fname'] : ''; $smail->set_params($name, $udata['email']); $smail->subject = $subject; $smail->to = array('name' => $to_name, 'email' => $to_email); //添付ファイル foreach ($_SESSION['qform']['_FILES'] as $f) { if (file_exists($f['path'])) { $smail->add_attaches($f['name'], $f['path']); } } $smail->send($mailbody); } } // ------------------------------- // session destroy & tmpfile unlink // ------------------------------- plugin_qform_unlink_attaches(); $_SESSION['qform'] = null; unset($_SESSION['qform']); // ------------------------------- // post // ------------------------------- if (isset($conf['finish_post'])) { $dat = $conf['finish_post']['data']; $to_enc = $conf['finish_post']['encode']; $url = $conf['finish_post']['url']; foreach ($dat as $key => $val) { $val = str_replace($search, $udata, $val); $dat[$key] = mb_convert_encoding($val, $to_enc, 'UTF-8'); } $pdata = http_build_query($dat, "", "&"); $res = do_post_request($url, $pdata); //echo $res; } // -------------------------------- // redirect // -------------------------------- if (isset($conf['finish_url']) && is_url($conf['finish_url'])) { header('Location: ' . $conf['finish_url']); exit; } // --------------------------------- // 完了ページの表示 // --------------------------------- if (isset($conf['finish_msg'])) { $body = str_replace($search, $udata, $conf['finish_msg']); force_output_message($qm->m['plg_qform']['title_finished'], $page, convert_html($body)); } else { force_output_message($qm->m['plg_qform']['title_finished'], $page, $qm->m['plg_qform']['finished']); } }
function dl_sendmail($email, $filename, $title) { global $smtp_auth, $smtp_server, $google_apps, $google_apps_domain; $qm = get_qm(); $xsubject = $title == '' ? $qm->replace('plg_dlbutton.subject', '') : $title; $xmsg = $qm->replace('plg_dlbutton.mail_body', $filename); $xheader = "From: " . $email . "\n"; $xparameter = "-f" . $email; //Mail send setting if ($google_apps && preg_match('/.*' . $google_apps_domain . '$/', $email)) { $mail = new Qdmail(); $mail->smtp(true); $param = array('host' => 'ASPMX.L.GOOGLE.com', 'port' => 25, 'from' => $email, 'protocol' => 'SMTP', 'user' => 'root@' . $google_apps_domain, 'pass' => $passwd); $mail->smtpServer($param); $mail->to($email); $mail->subject($xsubject); $mail->from($email); $mail->text($xmsg); $return_flag = $mail->send(); } else { $mail = new SimpleMail(); $mail->set_params('', $email); $mail->set_to('', $email); $mail->set_subject($xsubject); $mail->send($xmsg); } }