資料註冊後發信小技巧

<?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
Reply-To:$from_email”;
$result=@mail($to_email,$subject,$contents,$header_info);
if($result) {
echo “發信成功!”;
} else {
echo “發信失敗!”;
}
?>

//wellcom.txt內容;
您的註冊資料為:
用戶名:<username>
密碼:<password>

歡迎您的到來!

歡迎訪問:<url> 

You May Also Like