PHP Mail not workign in Godaddy Linxu Shared Hosting

Suddenly, my contact form is not working at all. I have hosted 5 websites on godaddy, and Once again GoDaddy give me a headache.

The code is working absolutely fine few days back and it is also working fine on other shared hosting servers other than Godaddy. I have not changed any code.

Can anyone help me. What Should I do. It seems it is not working for gmail, yahoo or any other domain.

I have also tested with full headers in my code but it seems not working at all.

I have also test this two simple code but email never deliver.


<?php
     $emailto = "xxxxxx@gmail.com";
    $emailsubject = "You got a quiry";
    $emailmessage = "Test";
    $emailfrom = "xxxxxx@gmail.com";

if(mail($email_to, $emailsubject, $emailmessage, "From: <$emailto>")) {
echo "Thank you for contacting us. We will be in touch with you very soon."; }
else { "No"; }

?>

or


<?php
     $emailto = "xxx@gmail.com";
    $emailsubject = "You got a quiry";
    $emailmessage = "Test";
    $emailfrom = "xxxxxx@gmail.com";

if(mail($emailto, $emailsubject, $emailmessage, $headers)) {
echo "Thank you for contacting us. We will be in touch with you very soon."; }
else { "No"; }

?>

Output is Thank you for contacting us… but email never delivers

Try this


$emailto = xxx@gmail.com;
$emailsubject = "You got a quiry";
$emailmessage = "Test";
$emailfrom = "xxxxxx@gmail.com";
 
 
 
$headers = "MIME-Version: 1.0\\r\
"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\\r\
"; 
$headers .= "From: website@mywebsite.com\\r\
"; 
$headers .= "X-Mailer: PHP \\r\
";
 
if(mail($emailto, $emailsubject, $emailmessage, $headers)) {
  echo "Thank you for contacting us. We will be in touch with you very soon."; 
}else{ 
  echo "Not sent"; 
}
 
?>  
 
 

Tested, changed variables from xxx to my email and changed my email in headers, this is also not working…

I am in serious trouble, right now… One of my website is ecommerce website and i am not able to receive customer inquiry.

What output are you getting from the if where mail() is? - Thank you or Not sent?

Got an email after half an hour that means i have to use email@mywebsite.com in headers.

but how to edit my contact form of prestashop? and other scripts? Have to manually do this for every sites?

Well unless you can come up with a way to automatically change it in all of your sites then yes you’ll have to do it manually.

All emails should have a email address in the header stating where its from. If you don’t do that then your emails might be delayed, rejected, bounced etc. If you didn’t supply that in the first place then you’re not using mail() properly.

Now, which output are you getting from your call to mail() - Thank you… or Not sent? - We can only help you if you answer our questions.

I am getting “Thank you” output. But if i use my gmail in headers, mail never arrive

GMail?.. Oh boy… I’ve used fakesendmail with gmail and it doesn’t allow you to specify your own from email address when using the -f parameter. When I realised gmail was difficult to use for php sent emails I stopped trying.

So just to clarify you’re on a linux server or windows using fakesendmail/smtp to gmail?

fakesendmail/smtp?

If you’ve not heard of fakesendmail then you probably don’t need to worry about it. Basically it is a windows version of the linux sendmail program. It works with php and when php passes email to it, it will then connect to a SMTP server and send the email.

I suspect your problem may be gmail itself. I’ve had problems with it myself. Unfortunately mail() doesn’t provide any errors other than false if it failed. Because of this you will need to attempt to track down the problems with the server etc yourself as we can’t do much.

Talked with Godaddy support guy and they said GoDaddy disabled mail( function for gmail, yahoo and other common email providers and only allow for email address ending in your domain name.

This was enabled few days back and they disabled it now without informing their customers.

Well at least that confirms the problem. Unfortunately it doesn’t help you though :frowning:

However thanks for your time and support.

Locate your email scripts on a server of another hosting company that treats it clients more professionally, then just reference the sites back to those scripts to send your mail.