PHP mailer help! Contact form will send to gmail but not hotmail.
#1
Posted 10 January 2012 - 10:20 AM
working on my first contact form and its been a bit of a nightmare with all of the validation and php but I have finally got a working form that will email over the details!
However, it will not send to my Hotmail account but will to my gmail account and my client uses Hotmail.
I have read various threads and it seems that a lot of people have had this issue but I have found no clear solution so I was wondering if any one on here has had this problem or knows how to solve it?
Thank you!
the code without validation -
<?php
$myemail = 'myemail@gmail.com';//<-----Put Your email address here.
$title = 'Quote';
$name = $_POST['name'];
$company = $_POST['company'];
$house = $_POST['house'];
$street = $_POST['street'];
$postcode = $_POST['postcode'];
$daynum = $_POST['daynum'];
$evenum = $_POST['evenum'];
$email = $_POST['email'];
$how = $_POST['product'];
$information = $_POST['information'];
/* foreach($_POST['check'] as $value) {
$check_msg .= "$value\n";
} */
$to = $myemail;
$email_subject = "Quote: $name";
$email_body = "You have received a new quote from $name. ".
" Here are the details:\n \n Company: $company\n \n House: $house\n \n Street: $street\n \n Postcode: $postcode\n \n Daytime Number: $daynum\n \n Evening Number: $evenum\n \n Email: $email\n \n Products: $check_msg\n \n Additional Information: $information\n \n How: $how";
$headers = "From: $title\n";
$headers .= "Reply-To: $email";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: thank-you.html');
?>
#2
Posted 10 January 2012 - 04:40 PM
Twan, on 10 January 2012 - 10:20 AM, said:
working on my first contact form and its been a bit of a nightmare with all of the validation and php but I have finally got a working form that will email over the details!
However, it will not send to my Hotmail account but will to my gmail account and my client uses Hotmail.
I have read various threads and it seems that a lot of people have had this issue but I have found no clear solution so I was wondering if any one on here has had this problem or knows how to solve it?
Thank you!
the code without validation -
<?php
$myemail = 'myemail@gmail.com';//<-----Put Your email address here.
$title = 'Quote';
$name = $_POST['name'];
$company = $_POST['company'];
$house = $_POST['house'];
$street = $_POST['street'];
$postcode = $_POST['postcode'];
$daynum = $_POST['daynum'];
$evenum = $_POST['evenum'];
$email = $_POST['email'];
$how = $_POST['product'];
$information = $_POST['information'];
/* foreach($_POST['check'] as $value) {
$check_msg .= "$value\n";
} */
$to = $myemail;
$email_subject = "Quote: $name";
$email_body = "You have received a new quote from $name. ".
" Here are the details:\n \n Company: $company\n \n House: $house\n \n Street: $street\n \n Postcode: $postcode\n \n Daytime Number: $daynum\n \n Evening Number: $evenum\n \n Email: $email\n \n Products: $check_msg\n \n Additional Information: $information\n \n How: $how";
$headers = "From: $title\n";
$headers .= "Reply-To: $email";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: thank-you.html');
?>
if that form is for a client i'd just use a prebuilt form, i know your learning but that forms badly coded, and i'd recommend for the clients sake get a prebuilt contact form and use.
#3
Posted 10 January 2012 - 04:50 PM
webdesigner93, on 10 January 2012 - 04:40 PM, said:
well the form was one that I had taken from the internet and just changed slightly.
I have just started in PHP so I would never attempt to do it myself.
Maybe looking into using a more robust PHP mailer will solve this issue.
Thank you
#4
Posted 10 January 2012 - 05:10 PM
Twan, on 10 January 2012 - 04:50 PM, said:
I have just started in PHP so I would never attempt to do it myself.
Maybe looking into using a more robust PHP mailer will solve this issue.
Thank you
Yes use a well known one not just one someone tried to teach with
#5
Posted 11 January 2012 - 11:05 AM
webdesigner93, on 10 January 2012 - 05:10 PM, said:
I did a quick test and used your contact form which is pinned in the forum.
All that I did was turn off the captcha and change the email address to my hotmail account and it still did not work.
Tested on gmail and it does work.
Could this be anything to do with my host being blacklisted by hotmail?
#8
Posted 11 January 2012 - 02:02 PM
Twan, on 11 January 2012 - 11:05 AM, said:
All that I did was turn off the captcha and change the email address to my hotmail account and it still did not work.
Tested on gmail and it does work.
Could this be anything to do with my host being blacklisted by hotmail?
Mmm that version on the forum is an older version but even that should work, its been tested with hotmail and yahoo and works fine
#9
Posted 11 January 2012 - 02:03 PM
$title = 'Quote'; $headers = "From: $title\n";
#13
Posted 12 January 2012 - 11:48 AM
"You could try making sure that the mails are being sent from a real mailbox. That in some situations can help, alternatively you may need a dedicated IP address and reverse DNS setup."
Would anyone be able to point me in the right direction for sending the form from a real mailbox?
thanks,
- ← sessions are not setting
- Server Side (PHP, Databases, ASP.NET, etc)
- db username and password in php →
Help















