如何使用php的mail函数

来源:百度知道 编辑:UC知道 时间:2024/06/17 11:36:59
怎么php的smtp服务器设置成非本机的,比如smtp.163.com什么的~~
我现在把smtp服务器设置成了smtp.163.com,那么如何使用mail函数来收发邮件呢?

可以,但是这要需要smtp.163.com的用户名与密码
我给你一个邮件发送类,你可以直接用
/*
名称:smtpsend.class.php
功能:邮件发送类,实现邮件发送功能 ,可以发送html邮件;可验证用户是否具有发送权限;可实现从任意服务器邮箱发送邮件,并非局限于本机。
时间:2008-03
author:三生石

$smtpserver; SMTP服务器
$smtpserverport; SMTP服务器端口
$smtpuser; SMTP服务器的用户帐号
$smtppass; SMTP服务器的用户密码
$fromMail; SMTP服务器的用户邮箱
$toMail; 发送给谁
$subject; 邮件主题
$content; 邮件内容
$mailtype; 邮件格式(HTML/TXT),TXT为文本邮件
*/
class smtpclass
{

function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)

{

$this->debug = FALSE;

$this->smtp_port = $smtp_port;

$this->relay_host = $relay_host;

$this->time_out = 60; //is used in fsockopen()

$this->auth = $auth;//auth

$this->user = $user;

$this->pass = $pass;

$this->host_name = "localhost"; //is used in HELO comm