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 = "[email protected]"; $headers = "From: $from"; mail($to,$subject,$message,$headers); is it because of the hosting mail server or anything else? tq Link to comment https://forums.phpfreaks.com/topic/168290-problem-with-sending-email/ 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 [email protected] 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. Link to comment https://forums.phpfreaks.com/topic/168290-problem-with-sending-email/#findComment-887656 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 Link to comment https://forums.phpfreaks.com/topic/168290-problem-with-sending-email/#findComment-887663 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. Link to comment https://forums.phpfreaks.com/topic/168290-problem-with-sending-email/#findComment-887821 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)? Link to comment https://forums.phpfreaks.com/topic/168290-problem-with-sending-email/#findComment-887830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.