Forum Moderators: mack

Message Too Old, No Replies

mail() not functioning

I get the error message "unrouteable mail domain"

         

siraxi

5:32 pm on Mar 1, 2004 (gmt 0)

10+ Year Member



Hello

I have come across this problem: the mail() function from php doesn't seem to do its job.

I'm using a form which points to a php page which collects the information entered in the form and sends it to me by email using the mail() function and also sends to the user a confirmation message at the email address entered.

The first part is completed with success, I get the information from the form, but the user doesn't receive the confirmation message. Instead I get a error message "Mail delivery failed: returning message to sender" with a copy of the message and "unrouteable mail domain" - for whatever email address entered.

I think the problem is that mail() doesn't read properly the $email variable, because if I use a predefined constant such as $email="email@addresss.com" the messeage reaches at its destination.

Here's the source:

<?php
$email = $_REQUEST['email'];

...

mail ("$email", "Email subject", "Email body", "From: Me <my_email@my_address.com>");

?>

What is the problem? And the solution.

Any input would be highly appreciated.
Thank you.

georgiek50

10:38 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



If you copy/pasted your code disregard this but make sure you are not using single quotes around $email like so: '$email'...this one has lost me countless hours of debugging on several occassions.

If it's not this then I don't have another answer.

siraxi

6:37 am on Mar 3, 2004 (gmt 0)

10+ Year Member



Thank you for your reply, but it isn't the case. I am aware of the differences that may occur in using ' instead of "

Searching the programming forums on the net I've seen this is quite a common problem among the webmasters (in some cases).
I thinking:what if I change my hosting server - would it make a difference? Or what if I use just for that a php page hosted on a different server - in a different website. And then just use <?php include('http://othersite.com/mailpage.php');?>
where mailpage.php contains the mail() function.

I'll try it and let you know of its result.

siraxi

8:35 am on Mar 6, 2004 (gmt 0)

10+ Year Member




The same result ...

I have managed to avoid somehow this issue, having noticed that the only domain name that mail() can sen email to, is my own.

Therefore, I sent an email to another email address of mine, which was set as an auto-responder, such sending the confirmation message.

But this way doesn't allow me to send personalized email messages, which is baaad.