用PHP實(shí)現(xiàn)用From發(fā)送電子郵件
來源:程序員人生 發(fā)布時(shí)間:2013-12-31 18:43:06 閱讀次數(shù):3529次
說明:用PHP實(shí)現(xiàn)發(fā)送電子郵件是比較簡單的,大家可以看看如下完整代碼。
1,把下面這段代碼復(fù)制到你的網(wǎng)頁中,可以復(fù)制到.HTML文件中。
- <form action="mail.php" method="post">
- <p align="center">
- <font face="Verdana">
- Name:<br>
- <input type="text" name="name" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF"><br>
- E-Mail Address:<br>
- <input type="text" name="email" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF"><Br>
- Website URL:<br>
- <input type="text" name="url" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF"><Br>
- <input type="submit" value="Submit" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF">
2,建立mail.php文件,并且和上面的保存在同一個(gè)目錄中。
- <?
- $contactemail = "you@yourdomain.com";
- $subject = "You choose";
- $message .= "Name: $namen";
- $message .= "E-mail: $emailn";
- $message .= "Website URL: $urln";
- mail($contactemail, $subject, $message);
- echo "Thanks for mailing me, I should reply with in a few
- days."
- ?>
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)