I have 3 PHP forms on my website - all use the PHP send() function, and all stopped working on GoDaddy's Windows server. We also do not host our email at GoDaddy, but do have the domain registered with GoDaddy. The forms work perfectly on Linux hosting. After days of research, I figured out the solution below:
1. You need to create a SPF Record and add it to your domain records as a txt file. For instructions on creating the SPF file for Gmail here is the link - https://support.google.com/a/answer/33786?hl=en. However, no matter what email hosting you're using, the record you add will be very similar and will look like this -
v=spf1 include:serverdomain.com include:_spf.google.com ~all. By adding this record, you're basically telling the server that it's safe to use your outside hosting to process email.
If you need help on adding it just search a little on GoDaddy's forums or wherever your domain is hosted, or contact tech support. It's a quick and simple process.
2. Once you add this, it may take 24-48 hours to process - it did for me.
3. Back in your PHP form - Make sure that you designate a "From" email address ($From = 'firstname.lastname@example.org';) which matches the domain in the SPF Record. So, if you added Google's mail servers in the SPF Record, make sure your "FROM" field in your form is something like "email@example.com".
4. Finally, in your PHP form, make sure you add an ",-f .$From" to the end of your mail array so that if looks like this -
mail($emailTo, $subjectTitle, $body, $headers, '-f'.$From);
This assures the server that your email is not spam.
I hope this helps some of you avoid the many painful hours I had to endure to finally figure this one out!
Solved! Go to Solution.
I am receiving all mail in my spam folder. This is my code sample: Please help me on this
$mail = new PHPMailer;
//Enable SMTP debugging.
$mail->SMTPDebug = 3;
//Set PHPMailer to use SMTP.
//Set SMTP host name
$mail->Host = "smtp.gmail.com";
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
//Provide username and password
$mail->Username = "firstname.lastname@example.org";
$mail->Password = "super_secret_password";
//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";
//Set TCP port to connect to
$mail->Port = 587;
$mail->From = "email@example.com";
$mail->FromName = "Full Name";
$mail->addAddress("firstname.lastname@example.org", "Recepient Name");
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
echo "Mailer Error: " . $mail->ErrorInfo;
echo "Message has been sent successfully";
I've added a form to my Rapidweaver site, HTML Contact Form from Doobox. I set it to send to my aol.com account. I tested it and nothing has come through. From what I've found in the forum, it's a setting in Godaddy's cPanel but don't know where to look. I'd appreciate any advice on how to fix this.