Jump to content

php mail form doesnt work; need help...


eubby

Recommended Posts

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.

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.