I have a question about mail() function. I used mail function to create form contact for my website, but it's not working. Because this is first time i use host premium and using php to create form contact so maybe i dont know how to config for it working.
I code it as follow :
- Code: Select all
<?php
$to = youremail@host.com;
$mess = "This is message";
$subject = "test mail";
$header = "From : myemail@gmail.com";
if(mail($to, $subject, $mess, $header)){
echo "Your mail has been send!";
}else{
echo "Can not send your mail now! Plz try later.";
}
?>
That code just an example of mail function i used, not full of form.
It not work when i upload on my host.
and I tried another method to send mail , by using PHPmailer, but it's also not working.
I create two mail address of my host, and using it to send mail to gmail ---> it's work well, and from gmail to it ---> it's also work well.
But i can not use mail() to send mail from form contact.
Anyone could help me solve this problem? There is any config i should do for it working?

