Пример #1
0
	function sendmail($to, $from, $personal, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = "") {
		$subject = $this->getBase64($subject);
		$mail_from = $this->get_address ( $this->strip_comment ( $from ) );
		$body = ereg_replace ( "(^|(\r\n))(\\.)", "\\1.\\3", $body );
		$body = base64_encode($body);
		$toencode = $this->getBase64($to);
		$ccencode = $this->getBase64($cc);
		$personalencode = $this->getBase64($personal);
		$header .= "X-Originating-IP:".get_client_ip()."\r\n";
		$header .= "MIME-Version:1.0\r\n";
		if ($mailtype == "HTML") {
			$header .= "Content-Type:text/html;charset=\"UTF-8\"\r\n";
		}
		$header .= "To: \"" . $toencode . "\" <" . $to . ">;\r\n";
		if ($cc != "") {
			$header .= "Cc: " . $ccencode . "\r\n";
		}
		$header .= "From: \"$personalencode\" <" . $from . ">;\r\n";
		$header .= "Subject: " . $subject . "\r\n";
		$header .= $additional_headers;
		$header .= "Date: " . date ( "r" ) . "\r\n";
		$header .= "X-Mailer:By RJS (PHP/" . phpversion () . ")\r\n";
		list ( $msec, $sec ) = explode ( " ", microtime () );
		$header .= "Message-ID: <" . date ( "YmdHis", $sec ) . "." . ($msec * 1000000) . "." . $mail_from . ">;\r\n";
		$header .= "Content-Transfer-Encoding: base64\r\n";
		$TO = explode ( ",", $this->strip_comment ( $to ) );
		if ($cc != "") {
			$TO = array_merge ( $TO, explode ( ",", $this->strip_comment ( $cc ) ) );
		}
		if ($bcc != "") {
			$TO = array_merge ( $TO, explode ( ",", $this->strip_comment ( $bcc ) ) );
		}
		$sent = TRUE;
		foreach ( $TO as $rcpt_to ) {
			$rcpt_to = $this->get_address ( $rcpt_to );
			if (! $this->smtp_sockopen ( $rcpt_to )) {
				LOG::write( "Error: Cannot send email to " . $rcpt_to, LOG::ERR);
				$sent = FALSE;
				continue;
			}
			if ($this->smtp_send ( $this->host_name, $mail_from, $rcpt_to, $header, $body )) {
				LOG::write( "E-mail has been sent to <" . $rcpt_to, LOG::INFO);
			} else {
				LOG::write( "Error: Cannot send email to <" . $rcpt_to, LOG::ERR);
				$sent = FALSE;
			}
			fclose ( $this->sock );
			$this->log_write ( "Disconnected from remote host\n" );
		}
		return $sent;
	}
Пример #2
0
 public function doBind()
 {
     $bindCode = text($_POST['bindCode']);
     $bind_name = text($_POST['bind_name']);
     $bindid = session("temp_bindid");
     if (empty($bindid)) {
         ajaxmsg('请先发送短信验证码!', 0);
     }
     $bindid = intval($bindid);
     if (session("temp_bindusername") != $bind_name) {
         ajaxmsg('您已经修改绑定账号,请重新发送短信校验码!', 0);
     }
     if (is_verify($this->uid, $bindCode, 8, 10 * 60)) {
         LOG::write("bindid:" . $bindid . ",uid:" . $this->uid, Log::DEBUG);
         M("members")->where(array("id" => $this->uid))->save(array("bind_uid" => $bindid));
         session("temp_bindid", null);
         session("temp_bindusername", null);
         ajaxmsg('绑定成功!');
     } else {
         ajaxmsg('短信校验码不正确!!', 0);
     }
 }
Пример #3
0
function logWarn($msg)
{
    LOG::write($msg, 'WARN');
}
Пример #4
0
	public function massSend($mob,$content,$time)
	{
	
		$http = 'http://119.145.9.12/sendSMS.action';
		$content = str_replace("@", "", $content);
		$data = array
		(
				'enterpriseID'=>"15621",
				'loginName'=>"admin",
				'password'=>strtolower(md5("ytt131021")),
				'smsId'=>"",
				'subPort'=>"",
				'Phone'=>"",
				'mobiles'=>$mob,
				'content'=>$content,
				'sendTime'=>$time
		);
		$ret = $this->do_post($http, $data);
		$xml = simplexml_load_string($ret);
		if($xml->Result != 0){
			LOG::write(dump($xml, false, null, false));
		}
		return $xml;
	}