我試圖一個隨機數發送到電子郵件,但不能這是我已經能夠拿出這麼遠 請幫助,如果可能的發送隨機數到電子郵件PHP
sendmail的代碼。 PHP
$to = $_POST['email'];
$header ='From:[email protected]';
$subject ='Verification Code';
if(empty($to))
{
echo "Email is Empty";
}
else
{
if (mail($to,$subject,$message,$header)){
echo 'Check Your Email FOr verfication code';
}
else{
echo 'Failed';
}
}
的index.php
<form action = "register.php" method="POST">
<p>Username</p>
<input type="text" name="username" maxlength="40" value='<?php if(isset($username)) echo $username ?>'"><br>
<p>New Password</p>
<input type="password" name="password">
<p>email</p>
<input type="text" name="email" maxlength="40" value='<?php if(isset($email)) echo $email ?>'"> <br><br>
<input type="submit" value="Register"> <br><br>
</form>
你面臨什麼問題? –
電子郵件將不會發送 – Kunz
它說失敗; – Kunz