如果用户想向我的网络邮箱发送电子邮件,此代码是否足够?还是我需要做出改变?
<?php
$mail = $_POST['mail'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$text = $_POST['text'];
$to = "youremail@domain.com";
$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";
}
?>