指定E-mail(未測試, 請先測試..)
<? if (isset($_POST['post']) && $_POST['title'] && $_POST['massage']){ $to = 'admin@lugia.org'; $message = ' <html> <head> <title>'.htmlspecialchars($_POST['title']).'</title> </head> <body> '.nl2br(htmlspecialchars($_POST['massage'])).' </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; mail($to, $_POST['title'], $message, $headers); exit('Finish'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Testing</title> </head> <body> <form id="form1" method="post" action=""> <p>Title:<br /> <label> <input name="title" type="text" id="title" maxlength="50" /> </label> </p> <p>Massage:<br /> <label> <textarea name="massage" id="massage" cols="45" rows="5"></textarea> </label> </p> <p> <label> <input type="submit" name="send" id="send" value="Send" /> </label> <label> <input type="reset" name="reset" id="reset" value="Reset" /> </label> <input name="post" type="hidden" id="post" value="1" /> </p> </form> </body> </html> 同樣, 有指定內容
<? if (isset($_POST['post']) && $_POST['name']){ $to = 'admin@lugia.org'; // message $message = ' <div id="open-letter"> <p> Dear Group CEO Patrick Cescau, </p> <p> The palm oil Unilever buys to make Dove soap is destroying forests and speeding up climate change. Your palm oil suppliers continue to destroy Indonesia\'s precious rainforests for palm plantations, even though they have promised to change. They haven\'t changed, but Unilever still buys from them, with no consideration for the endangered animals and people who depend on these forests. </p> <p> Unilever is one of the biggest global consumer goods companies and buys around 1.3 million tonnes of palm oil every year. A truly responsible company would not buy from suppliers who trash forests. Unilever should call for an immediate halt to the destruction of Indonesia\'s forests for palm oil. </p> <p> Wrecking rainforests for soap and other products is wrong. Will you help save the forests now, or continue destroying them? </p> <p> Sincerely, </p> <p> <em>'.htmlspecialchars($_POST['name']).'</em> </p> </div> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; // Mail it mail($to, 'AN OPEN LETTER TO UNILEVER', $message, $headers); exit('Finish'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Testing</title> </head> <body> <form id="form1" method="post" action=""> <p>Name:<br /> <label> <input name="name" type="text" id="name" maxlength="50" /> </label> </p> <p> <label> <input type="submit" name="send" id="send" value="Send" /> </label> <label> <input type="reset" name="reset" id="reset" value="Reset" /> </label> <input name="post" type="hidden" id="post" value="1" /> </p> </form> </body> </html> [ 本帖最後由 火雞一隻 於 6/5/2008 08:25 AM 編輯 ] |