sending email in php
i am trying to send a random number to a email this is what i have so far
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
$rand= mt_rand(100000, 999999)// random number generator
$email = $_POST['email'];
$to=$email;
$header ='From:admin@domain.com';
$subject ='Verification Code';
$body = $rand;
if (mail($to,$subject,$body,$header))
{
echo 'Check Your Email FOr verfication code';
}
else{
echo 'Failed';
}
|
1 2 3 4 5
|
<p>email</p>
<input type="text" name="email" maxlength="40"
value='<?php if(isset($email)) echo $email ?>'"> <br>
<input type="submit" value="Register"> <br><br>
|
Topic archived. No new replies allowed.