Note: The PHP environment is fully configured, refer to http://www.cnblogs.com/homezzm/archive/2012/08/01/2618062.html
1. Local Windows needs to install SMTP server, we recommend using free SMTP server, link--http://www.softstack.com/freesmtp.html
2. After the installation is complete, check your PHP configuration file, which is the following configuration in php.in:
SMTP = localhost
; Http://php.net/smtp-port
Smtp_port = 25
3. Next demo code, create an HTML form input, a PHP file for processing, the local SMTP server acts as a post office outgoing.
(1) feedback.html
1 <formAction= "processfeedback.php"Method= "POST"xmlns= "http://www.w3.org/1999/html">2 <BR>Name</BR>3 <inputtype= "text"name= "Name"size= "6"></P>4 <P>Email</BR>5 <inputTYPR= "text"name= "Email"size= "+"maxsize= "Max"></P>6 <P>Your Feedback</BR>7 <inputtype= "text"style= "height:40px; width:125px"name= "Feedback"></P>8 <P><inputtype= "Submit"value= "Submit"></P>9 Ten </form>
(2) processfeedback.php
1<?PHP2Date_default_timezone_set ("PRC");3 $name=Trim($_post[' Name ']);4 $email=Trim($_post[' Email ']);5 $feedback=Trim($_post[' Feedback ']);6 $toaddress= "[email protected]";//here is the email address of the person you want to serve.7 $emailcontent= "Customer Name:".$name." Feedback: ".$feedback;8 $subject="$feedbackFrom Wed Site ";9 $fromaddress= "From:[email protected]";//the sender is his or her e-mail address, just write one of them.Ten Mail($toaddress,$subject,$emailcontent,$fromaddress);//The first parameter is the recipient address, the second is the title, the third is the content, and the fourth is the sender address One?> A - -<title>bob 's Auto parts-feedback submitted</title> the - <body> - - <p>your Feed back has been sent.</p> + <?php - Echo nl2br ($emailcontent); + ?> A </body> atUsing the Mail function in PHP