·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> 资料注册后发信小技巧

资料注册后发信小技巧

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23
<?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="[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 "发信失败!";
}
?>

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

欢迎您的到来!

欢迎访问:<url>