看板 PHP 關於我們 聯絡資訊
===============mail_form.php <html> <head> <title>郵寄表單</title> </head> <body> <form action="send_mail.php" method="post"> 收件人Email:<input type="text" name="mail2who"><br> <!--寄件人Email:<input type="text" name="mailheader"><br>--> 郵件主題:<input type="text" name="mail_title"><br> 郵件內容:<textarea name="mail_content" rows="5" cols="40"></textarea><br> <input type="submit" value="寄出"> </form> </body> </html> ================send_mail.php <?php mail($_POST['mail2who'],$_POST['mail_title'],$_POST['mail_content']); echo "已經寄出給{$_POST['mail2who']}囉!"; ?> ================php.ini內部設定 [mail function] ; For Win32 only. ;[修改]將SMTP伺服器的位址指向gmail的SMPT伺服器位址 SMTP = msa.hinet.net smtp_port = 25 ; For Win32 only. ;[修改]寄件者設定為[email protected] sendmail_from = [email protected] ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = ================出現的問題 Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\AppServ\www\canthony\mail\send_mail.php on line 2 ================相關資訊 我的OS是 : WINDOWS 7 用的是==> appserv 2.5.10 網路 ==> Hinet 2M 爬過文!! 但是還是找不出問題原因= = 所以想請大家幫幫忙:) 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.229.91.137
chenlifu:建議用 phpmailer 比較快~ 01/27 23:03