资料注册后发信小技巧
发布时间:2006-10-14 2:57:30   收集提供:gaoqian
<?php
//mail.php
//读信内容
$filename = "wellcom.txt";
$fd = fopen( $filename, "r" );
$contents = fread($fd, filesize($filename));
fclose( $fd );

//替换其中相应内容
$contents=eregi_replace("<username>",$UserName,$contents);
$contents=eregi_replace("<password>",$Password,$contents);
$contents=eregi_replace("<url>",$Url,$contents);

//发信
$to_email=$email;
$from_email="php-java@21cn.com";
$subject="Wellcom!";
$header_info="From:$from_email\nReply-To:$from_email";
$result=@mail($to_email,$subject,$contents,$header_info);
if($result) {
echo "发信成功!";
} else {
echo "发信失败!";
}
?>

//wellcom.txt内容;
您的注册资料为:
用户名:<username>
密码:<password>

欢迎您的到来!

欢迎访问:<url> 
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50