如果用戶想要發送郵件到我的webmail,這個代碼是否足夠了?或者我需要做出改變?PHP郵件表單調整
<?php
$mail = $_POST['mail'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$text = $_POST['text'];
$to = "[email protected]";
$message =" You received a mail from ".$name;
$message .=" Text of the message : ".$text;
if(mail($to, $subject,$message)){
echo "Your message was sent successfully.";
}
else{
echo "there's some errors to send the mail, verify your server options";
}
?>
從第一眼看就夠了! – Rikesh
@syneidesys:是否有任何錯誤? –
如果你已經smtp設置,那麼上面的代碼應該工作其他明智的你必須設置smtp,[這](http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm)可能對你有用 –