资料注册后发信小技巧

 1   
 2//mail.php   
 3//读信内容   
 4$filename = "wellcom.txt";   
 5$fd = fopen( $filename, "r" );   
 6$contents = fread($fd, filesize($filename));   
 7fclose( $fd );   
 8  
 9//替换其中相应内容   
10$contents=eregi_replace("

<username>",$UserName,$contents);
$contents=eregi_replace("<password>",$Password,$contents);
$contents=eregi_replace("<url>",$Url,$contents);

//发信
$to_email=$email;
$from_email="[email protected]";
$subject="Wellcom!";
$header_info="From:$from_email\nReply-To:$from_email";
$result=@mail($to_email,$subject,$contents,$header_info);
if($result) {
echo "发信成功!";
} else {
echo "发信失败!";
}

1  
2//wellcom.txt内容;   
3您的注册资料为:   
4用户名:<username>   
5密码:<password>   
6  
7欢迎您的到来!   
8  
9欢迎访问:<url></url></password></username></url></password></username>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus