} $adb->query($sql); } $options = array('id' => $id, 'server' => $server, 'server_port' => $port, 'server_username' => $server_username, 'server_password' => $server_password, 'server_type' => $server_type, 'smtp_auth' => $smtp_auth, 'smownerid' => $current_user->id, 'from_email' => $from_email, 'from_name' => $from_name); if ($server_type == 'email') { $key = "webmail_array_" . $current_user->id; } setSqlCacheData($key, $options); //Added code to send a test mail to the currently logged in user if ($server_type != 'backup' && $server_type != 'proxy') { include_once "modules/Webmails/mail.php"; global $current_user; $to_email = $server_username; $subject = $mod_strings['Test_mail_configuration']; $description = $mod_strings['Test_mail_Description']; $error_str = ""; if ($to_email != '' && $smtp_auth == 'true') { $mail_status = send_webmail($to_email, $subject, $description); if ($mail_status != "") { $error_str = "mail_error=" . urlencode($mail_status); } } //$action = 'EmailConfig'; //if($error_str != "") //$action = 'EmailConfig&emailconfig_mode=edit'; $action = 'index'; if ($error_str != "") { $action = 'index&emailconfig_mode=edit'; } } redirect("index.php?module=Relsettings&parenttab=Settings&action={$action}&{$error_str}");
} if ($email1 != '') { if ($emailtouser == 'on') { $interval = getIntervar($userid); if (!empty($interval)) { sleep($interval); } else { sleep(5); } $currenttime = date("Y-m-d H:i:s"); $maillogsid = $adb->getUniqueID("ec_maillogs"); $imghtml = '<img src="http://crm123.sinaapp.com/getMailId.php?mailid=' . $maillogsid . '" border=0 width="1" height="1" />'; $content = $content . $imghtml; //失败回调地址 $callback = "http://" . $_SERVER['HTTP_HOST'] . "/domailfailed.php?mailid={$maillogsid}"; $res = send_webmail($mail, $email1, $subject, $content, $userid, $callback); $array[] = array('url' => $url, "postdata" => "email={$email1}"); if ($res == '') { $flag = 1; $sendresult = "发送成功"; } else { $flag = 0; $sendresult = "发送失败" . $res; } saveMailLog($maillogsid, $userid, "自己", $email1, $subject, $content, $flag, $sendresult, $currenttime); } } } } } }
$subject = substr($posts[7], 8); $subject = str_replace("##", '&', $subject); //mailcontent $mailcontent = substr($posts[8], 12); $mailcontent = str_replace("##", '&', $mailcontent); $mailcontent = str_replace("\$name\$", $receiver, $mailcontent); //userid $userid_arr = explode("=", $posts[9]); $userid = $userid_arr[1]; $imgurl = $_SERVER['HTTP_HOST'] . '/getMailId.php?mailid=' . $maillogsid; $mailcontent = $mailcontent; //$mailcontent = stripHTML($mailcontent); //失败回调地址 //$callback = $site_URL."/domailfailed.php?sjid=$sjid&mailid=$maillogsid"; //发送邮件 $msg = send_webmail($to_email, $receiver, $from_name, $from_email, $subject, $mailcontent, $maillogsid, $userid); //send_webmail($to_email,$subject,$mailcontent,$callback); if (!empty($msg)) { $flag = 0; //failed $result = "发送失败" . $msg; $successrate = 0; } else { $flag = 1; //success $result = "发送成功"; $successrate = 1; } //保存单条邮件记录 saveMailLog($sjid, $maillogsid, $receiver, $to_email, $subject, $mailcontent, $flag, $result, $successrate, $userid); //删除该条Message
$j = 1; foreach ($sendresult as $rst) { if ($msflag == '1') { $msg = send_webmail($rst[0], "", "", $subject, $mailcontent, $sjid); } else { if (is_array($messinfos)) { $messstr = ''; foreach ($messinfos as $mess) { if ($mess == 'membername') { $messstr .= $rst[1]; } else { $messstr .= $mess; } } } $msg = send_webmail($rst[0], "", "", $subject, $messstr, $sjid); } if ($msg['error'] == '1') { $sendrst[$j] = 1; $rstmsg[$j] = "客户\"" . $rst[1] . "\\:" . $msg['message']; } else { $sendrst[$j] = 0; } $j++; } $failaccount = ''; foreach ($sendrst as $key => $st) { if ($st == '1') { $failaccount .= $rstmsg[$key] . ",\n"; } }
$result = $adb->query($sql); $id = $adb->query_result($result, 0, "id"); if ($db_update) { if ($id == '') { $id = $adb->getUniqueID("ec_systems"); $sql = "insert into ec_systems values(" . $id . ",'" . $server . "','" . $port . "','" . $server_username . "','" . $server_password . "','" . $server_type . "','" . $smtp_auth . "','" . $current_user->id . "','" . $from_email . "','" . $from_name . "')"; } else { $sql = "update ec_systems set server = '" . $server . "', server_username = '******', server_password = '******', smtp_auth='" . $smtp_auth . "', server_type = '" . $server_type . "',from_name = '" . $from_name . "',from_email = '" . $from_email . "',server_port='" . $port . "',smownerid='" . $current_user->id . "' where id = " . $id; } $adb->query($sql); } //Added code to send a test mail to the currently logged in user if ($server_type != 'backup' && $server_type != 'proxy') { include_once "modules/Webmails/mail.php"; global $current_user; $to_email = $server_username; $subject = $mod_strings['Test_mail_configuration']; $description = $mod_strings['Test_mail_Description']; $error_str = ""; if ($to_email != '' && $smtp_auth == 'true') { $mail_status = send_webmail('Users', $to_email, $from_name, $from_email, $subject, $description); if ($mail_status != "") { $error_str = "mail_error=" . urlencode($mail_status); } } $action = 'EmailConfig'; if ($error_str != "") { $action = 'EmailConfig&emailconfig_mode=edit'; } } header("Location: index.php?module=Relsettings&parenttab=Settings&action={$action}&{$error_str}");