optiplex Posted July 31, 2009 Share Posted July 31, 2009 ive tried this coding.. but the email didnt send at all... the code $to = "$t_email"; $subject = "Request account"; $message = "good morning. your application bla bla bla\n\n\nregards, admin"; $from = "xxyyzz@yahoo.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); is it because of the hosting mail server or anything else? tq Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 31, 2009 Share Posted July 31, 2009 My guess is your hosting service doesn't allow emails to be sent from external domains. If you change the $from to something@yourdomain.com does it work? Try removing the $headers part all together too. Long story short, your code is fine. Your hosting service must be blocking it for some reason. Call your hosting service and ask them what you need to do. Quote Link to comment Share on other sites More sharing options...
optiplex Posted July 31, 2009 Author Share Posted July 31, 2009 ermm.. may be u are rite.. but still cannot work.. ermmm Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 31, 2009 Share Posted July 31, 2009 Well, I just tested your code and it works fine. The only other thing it could be, is $t_email not being set correctly. Are you sure that value is good? Next step is to call your hosting service. It could be that mail is not configured correctly at all on the system and they need to change something at the system level. Either way, there is no other changes you can make from a coding level to make this work. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 31, 2009 Share Posted July 31, 2009 The From: address must be a valid mail box at the sending mail server. You should put any entered email address (after validating it) into the Reply-to: address, not the From: address. Most sending mail servers won't accept an email from a php script unless either the From: or the To: address is hosted at the sending mail server and receiving mail servers are not going to accept an email that has a domain in the From: address that does not match the sending mail server. Would you trust a letter that has a sender's address from someone you don't personally know (from a US address for example) that is completely different from the postmark of the post office where the letter was sent from (a postmark from China for example)? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.