Web Design Forum: PHP mailer help! - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

PHP mailer help! Contact form will send to gmail but not hotmail. Rate Topic: -----

#1 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 10 January 2012 - 10:20 AM

Hello all,

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');

?>
0

#2 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 10 January 2012 - 04:40 PM

View PostTwan, on 10 January 2012 - 10:20 AM, said:

Hello all,

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.
0

#3 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 10 January 2012 - 04:50 PM

View Postwebdesigner93, on 10 January 2012 - 04:40 PM, said:

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.


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
0

#4 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 10 January 2012 - 05:10 PM

View PostTwan, on 10 January 2012 - 04:50 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


Yes use a well known one not just one someone tried to teach with :)
0

#5 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 11 January 2012 - 11:05 AM

View Postwebdesigner93, on 10 January 2012 - 05:10 PM, said:

Yes use a well known one not just one someone tried to teach with :)


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?
0

#6 User is offline   Olavi 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 10
  • Joined: 11-January 12
  • Reputation: 2
  • Gender:Male
  • Location:Norway
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 11 January 2012 - 01:22 PM

Did you check spam folder?
0

#7 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 11 January 2012 - 01:41 PM

View PostOlavi, on 11 January 2012 - 01:22 PM, said:

Did you check spam folder?


Yep and it doesn't appear in the junk folder!
0

#8 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 11 January 2012 - 02:02 PM

View PostTwan, on 11 January 2012 - 11:05 AM, 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?

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
0

#9 User is offline   Olavi 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 10
  • Joined: 11-January 12
  • Reputation: 2
  • Gender:Male
  • Location:Norway
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 11 January 2012 - 02:03 PM

Try to change header 'from' content. Add proper e-mail.
$title = 'Quote';
$headers = "From: $title\n"; 

0

#10 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 11 January 2012 - 02:05 PM

View PostOlavi, on 11 January 2012 - 02:03 PM, said:

Try to change header 'from' content. Add proper e-mail.
$title = 'Quote';
$headers = "From: $title\n"; 



I think he means this
$headers = "From: $title <$to>\n"; 


i doupt that will work but u can try
0

#11 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 11 January 2012 - 02:14 PM

View Postwebdesigner93, on 11 January 2012 - 02:05 PM, said:

I think he means this
$headers = "From: $title <$to>\n"; 


i doupt that will work but u can try


Still no luck I'm afraid *sigh* but thank you.
I feel this problem may drive me insane...
Last thing to do before I can hand it over <_<
0

#12 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 11 January 2012 - 02:24 PM

View PostTwan, on 11 January 2012 - 02:14 PM, said:

Still no luck I'm afraid *sigh* but thank you.
I feel this problem may drive me insane...
Last thing to do before I can hand it over <_<

Send an email to ur host see what they have to say
0

#13 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 12 January 2012 - 11:48 AM

The reply that I got from my hosting service was-

"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,
0

#14 User is online   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,818
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 12 January 2012 - 01:46 PM

View PostTwan, on 12 January 2012 - 11:48 AM, said:



"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."


Name and shame the host who gave that advice!!!!!!!
0

#15 User is offline   Twan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 29-March 11
  • Reputation: 2
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Designer

Posted 12 January 2012 - 03:32 PM

View Postrallport, on 12 January 2012 - 01:46 PM, said:

Name and shame the host who gave that advice!!!!!!!


Evohosting...

Did think it was a bit strange. They were kind enough to tell me how much it would cost to do that too <_<
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users