当前位置: 移动技术网 > IT编程>开发语言>PHP > 资料注册后发信小技巧

资料注册后发信小技巧

2019年05月20日  | 移动技术网IT编程  | 我要评论
<?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> 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网