<?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>