⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example.php

📁 phpShop是一个基于php的分布式电子商务模块
💻 PHP
字号:
<?php
/***************************************
** Filename.......: test.php
** Project........: SMTP Class
** Last Modified..: 30 September 2001
***************************************/

	/***************************************
    ** Include the class. The header() makes
	** the output look lovely.
    ***************************************/
	include('class.smtp.inc');
	header('Content-Type: text/plain');

	/***************************************
    ** Setup some parameters which will be 
	** passed to the smtp::connect() call.
    ***************************************/
	$params['host'] = '10.1.1.2';				// The smtp server host/ip
	$params['port'] = 25;						// The smtp server port
	$params['helo'] = exec('hostname');			// What to use when sending the helo command. Typically, your domain/hostname
	$params['auth'] = TRUE;						// Whether to use basic authentication or not
	$params['user'] = 'testuser';				// Username for authentication
	$params['pass'] = 'testuser';				// Password for authentication

	/***************************************
    ** These parameters get passed to the 
	** smtp->send() call.
    ***************************************/

	$send_params['recipients']	= array('richard@[10.1.1.2]');							// The recipients (can be multiple)
	$send_params['headers']		= array(
										'From: "Richard Heyes" <richard@[10.1.1.2]>',	// Headers
										'To: richard@[10.1.1.2]', 'Subject: Test email'
									   );
	$send_params['from']		= 'richard@[10.1.1.2]';									// This is used as in the MAIL FROM: cmd
																						// It should end up as the Return-Path: header
	$send_params['body']		= '.Test email.';										// The body of the email


	/***************************************
    ** The code that creates the object and
	** sends the email.
    ***************************************/

	if(is_object($smtp = smtp::connect($params)) AND $smtp->send($send_params)){
		echo 'Email sent successfully!'."\r\n\r\n";

		// Any recipients that failed (relaying denied for example) will be logged in the errors variable.
		print_r($smtp->errors);

	}else{
		echo 'Error sending mail'."\r\n\r\n";
		
		// The reason for failure should be in the errors variable
		print_r($smtp->errors);
	}

?>

⌨️ 快捷键说明

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