这是php.ini中的设置.这个服务器以前好使现在不知道了. [mail function] ; For Win32 only. SMTP = bestdns.net; For Win32 only. sendmail_from = [email protected]; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path =如果你这个好用.或你能找到一个好使的服务加上去那么mail就会好使的.你试试吧.有好的服务器告诉我呀.呵呵.
要的话给我发信...
[email protected]
先谢了
http://www.hooday.com/?n=Classes&t=12
[mail function]
; For Win32 only.
SMTP = bestdns.net; For Win32 only.
sendmail_from = [email protected]; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =如果你这个好用.或你能找到一个好使的服务加上去那么mail就会好使的.你试试吧.有好的服务器告诉我呀.呵呵.
$CC = "yourname@yourhost";//Form
$MP = "/usr/sbin/sendmail -t";$filename = "./content.html";//信件要包含的html内容
$fd = fopen( $filename, "r" );
$contents = fread($fd, filesize($filename));
fclose( $fd ); $mail_array = file("./mail.txt");//收信人地址(每个E-mail地址占一行)
reset($mail_array)
foreach($mail_array as $key => $val){
$TO = $val;
$fd = popen($MP,"w");
fputs($fd, "To: $TO\n");
fputs($fd, "Cc: $CC\n");
fputs($fd, "From: your_name <your_login@your_domain_name>\n");
fputs($fd, "Subject: á?×óD?D?ê1 \n");
fputs($fd, "X-Mailer: PHP\n");
fputs($fd, "Content-Type: text/html; charset=us-ascii\n");
fputs($fd, "Content-Transfer-Encoding: 7bit\n");
fputs($fd, $contents);
// fputs($fd, "</body>\n");
pclose($fd);
exit;
echo "<li>".$val."发送成功";
}
?>从一个老外那里改的mail发送代码,就是发html内容用的。
能给多个地址发信但平台只能在*nix上,而且没有用到mail函数
但道理一样,应该对你有用的。呵呵。
$to="[email protected]";//a mail address
$subject="test mail";
$body="<table width='100%' border='1' cellspacing='0' cellpadding='0'>
<tr>
<td>11</td>
<td>12</td>
</tr>
<tr>
<td>21</td>
<td>22</td>
</tr>
</table>";
echo $subject;
echo $from;
$send=mail($to,$subject,stripslashes($body),"From: ".$from."\r\nContent-Type: text/html;charset=\"gb2312\"");
if($send)
echo "send";
else
echo "not send";
?>