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 = "[email protected]";

$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 = "[email protected]";

2) $to = "[email protected]";

 

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 [email protected], 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
https://forums.phpfreaks.com/topic/137538-php-mail-form-doesnt-work-need-help/
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 "[email protected]" account and that works very well for me.

Thank you for your reply.

 

I have tried the yahoo's forwarding option, supposedly all incoming mails will be forwarded to [email protected].

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

 

 

Archived

This topic is now archived and is closed to further replies.

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