sending a confirmation message automatically to a given email id
I have a form which has a field for email id. When form is submitted then a开发者_运维知识库 confirmation message should be send automatically to the given email id, how?
I want to do this in php.
<?php mail($email, 'thanks for your comment', 'many thanks, we will get back to you'); ?>
To send the messages use this code ,
<?php
//define the receiver of the email
$to = 'youraddress@example.com';
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
and for the activation code , use your database , create a table with email and number auto_increment and when he register in the database , in database will create the auto code and that code send to email ,
精彩评论