这个可以用。我使用过的
<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';// subject
$subject = 'Birthday Reminders for August';// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";// Mail it
mail($to, $subject, $message, $headers);
?>
<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';// subject
$subject = 'Birthday Reminders for August';// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";// Mail it
mail($to, $subject, $message, $headers);
?>
=======================================================
改成if($mails->send("","[email protected]","主题","内容"))
你是所用的是自己机子或者已经安装配置好了smtp服务器的机子,当然可以发送
可惜我现在是要用美国的服务器空间,人间需要认证的,我根本没法使用它的服务器,根本不可能发出去,只用通过socket连接才行啊。
我是掉了一个"s"
可我改过来后,运行结果是:
创建SOCKET:操作成功完成。
创建SOCKET连接:操作成功完成。 服务器应答:220 smtp.sina.com.cn ESMTP SINAMAIL (Postfix Rules!) 客户机命令:EHLO HELO 服务器应答:250-smtp.sina.com.cn 250-PIPELINING 250-SIZE 19660800 250-VRFY 250-ETRN 250-AUTH LOGIN 250-AUTH=LOGIN 250 8BITMIME 客户机命令:AUTH LOGIN 服务器应答:334 VXNlcm5hbWU6 客户机命令:bGl1Z2FvZGVtbQ== 服务器应答:334 UGFzc3dvcmQ6 客户机命令:NTMwNTkw 服务器应答:535 Error: authentication failed smtp 认证失败邮件服务器忙,请稍候再试试怎么修改?我就看看这个差不多行了,请高手帮忙!!!在线急等!!!!!!!
应该是下面的:
创建SOCKET:操作成功完成。
创建SOCKET连接:操作成功完成。 服务器应答:220 smtp.sina.com.cn ESMTP SINAMAIL (Postfix Rules!) 客户机命令:EHLO HELO 服务器应答:250-smtp.sina.com.cn 250-PIPELINING 250-SIZE 19660800 250-VRFY 250-ETRN 250-AUTH LOGIN 250-AUTH=LOGIN 250 8BITMIME 客户机命令:AUTH LOGIN 服务器应答:334 VXNlcm5hbWU6 客户机命令:bGl1Z2FvZGVtbQ== 服务器应答:334 UGFzc3dvcmQ6 客户机命令:bHVvamluZ3lp 服务器应答:235 Authentication successful 客户机命令:MAIL FROM:[email protected] 服务器应答:501 Bad address syntax 客户机命令:RCPT TO:[email protected] 服务器应答:503 Error: need MAIL command 客户机命令:DATA 服务器应答:503 Error: need RCPT command 客户机命令:From:[email protected] To:[email protected] Subject:主题 Content-Type: text/plain; charset=gb2312 内容 . 服务器应答:221 Error: I can break rules, too. Goodbye. 邮件发送失败邮件服务器忙,请稍候再试试