eubby Posted December 18, 2008 Share Posted December 18, 2008 I've created an email form for our company website, I used the following php code: code: <?php if(isset($_POST['submit'])) { $to = "admin@fp-consultants.com"; $subject = $_POST['subject']; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; mail($to, $subject, $body); } else { echo "blarg!"; } ?> Problem: 1) $to = "admin@fp-consultants.com"; 2) $to = "fp.consultants@yahoo.com.sg"; using the number 1 address, the message will not be received. using the number 2 address, the message will be sent and received. Question: 1) What could be the problem with the number 1 address? 2) The above code works fine using the yahoo email account, but it doesnt work using the admin@fp-consultants.com, why? 3) Is there any configuration on our mail server? or something to change on the code above? I hope you guys can help me to fix this problem. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/137538-php-mail-form-doesnt-work-need-help/ Share on other sites More sharing options...
premiso Posted December 18, 2008 Share Posted December 18, 2008 I know on my server, I cannot send emails from my server to any of the domains hosted on my server's email account. I am not sure why (never really digged into it). But that could be the same problem. What I did was setup a gmail account that I put a filter to forward any emails that came in from my server to the "admin@mydomain.com" account and that works very well for me. Quote Link to comment https://forums.phpfreaks.com/topic/137538-php-mail-form-doesnt-work-need-help/#findComment-718760 Share on other sites More sharing options...
dennismonsewicz Posted December 18, 2008 Share Posted December 18, 2008 i would also check your sites spam filters. Quote Link to comment https://forums.phpfreaks.com/topic/137538-php-mail-form-doesnt-work-need-help/#findComment-718784 Share on other sites More sharing options...
eubby Posted December 19, 2008 Author Share Posted December 19, 2008 Thank you for your reply. I have tried the yahoo's forwarding option, supposedly all incoming mails will be forwarded to admin@mydomain.com. But it doesn't work also. I have no mail received. I don't know if i will use gmail account. I will try. Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/137538-php-mail-form-doesnt-work-need-help/#findComment-719637 Share on other sites More sharing options...
Mad Mick Posted December 19, 2008 Share Posted December 19, 2008 Shouldn't the From field be the fourth parameter of the mail() function? At least that what they say at php.net. If not then perhaps the mail is not in the correct format and rejected by spam filters... Quote Link to comment https://forums.phpfreaks.com/topic/137538-php-mail-form-doesnt-work-need-help/#findComment-719651 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.