ps_mail.inc

来自「phpShop是一个基于php的分布式电子商务模块」· INC 代码 · 共 45 行

INC
45
字号
<?phprequire_once('admin/lib/ps_smtp.inc');class ps_mail {		function ps_mail() {				$this->params['host'] = SMTP_HOST;				// The smtp server host/ip		$this->params['port'] = SMTP_PORT;				// The smtp server port		$this->params['helo'] = exec('hostname');		// What to use when sending the helo command. Typically, your domain/hostname		$this->params['auth'] = SMTP_AUTH;				// Whether to use basic authentication or not		$this->params['user'] = SMTP_USER;				// Username for authentication		$this->params['pass'] = SMTP_PASS;	}	function send($to, $subject, $message, $from) {			if (SMTP_ENABLED) {			// Use SMTP			$send_params['recipients']	= array($to);							// The recipients (can be multiple)			$send_params['headers']		= array("From: $from", "To: $to", "Subject: $subject");			$send_params['from']		= $from;									// This is used as in the MAIL FROM: cmd																							// It should end up as the Return-Path: header			$send_params['body']		= $message;										// The body of the email					if(is_object($smtp = smtp::connect($this->params)) AND $smtp->send($send_params)){				return True;			} else {				$GLOBALS['vars']['error'] =  'Error sending mail'."\r\n\r\n";				// The reason for failure should be in the errors variable				print_r($smtp->errors);			}		}		else {			// Use the PHP mail command			mail($to, $subject, $message,"From: $from");		}	}	}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?