php mail under subdomains

php mail under subdomains

Posted by: timothy
Posted on: 2006-11-18 09:03:00

Hello,

I use a standard php mail function in one of my forms. The mail function works fine if its a root domain (the form is at: http://www.designsdigital.com/contact.htm )

I created a subdomain. (tektonika.desingsdigital.com) I use the same php mail function but it does not work under the subdomain. ( http://tektonika.designsdigital.com/bizeulasin.html )

why would that be? possible solutions?

Thanks.



Re: php mail under subdomains

Posted by: sdayman
Posted on: 2006-11-18 18:58:00

Do you have sm.php in both directories? Without seeing what sm.php does, it's hard to tell. If it's not a huge file, post it here and be sure to X out any sensitive information.

-Scott

Re: php mail under subdomains

Posted by: timothy
Posted on: 2006-11-19 01:11:00


Scott,

Yes, I do have sm.php in both directories.

Here is the sm.php... the good old mail func.

<?php
if ($REQUEST_METHOD == "POST") {
$txtname = strip_tags($txtname);
$txtcompany = strip_tags($txtcompany);
$txtemail = strip_tags($txtemail);
$txtcomments = strip_tags($txtcomments);

$sendto = "xxxxx@xxxxxx.com";
$subject = "Contact Form";
$message = "Senders Name: " . "$txtnamen" . "Email: " . "$txtemailn" . "Senders Website: " . "$txtcompanynn" . "Message:n " . "$txtcomments";

mail($sendto, $subject, $message);


}
?>


Thanks.


Re: php mail under subdomains

Posted by: sdayman
Posted on: 2006-11-19 07:12:00

I see that one uses $txtcompany while the other uses $txtwebsite. I hope your sm.php is different for both forms.

Other than that, I don't see any problems.

-Scott

Re: php mail under subdomains

Posted by: scjessey
Posted on: 2006-11-19 08:24:00

In reply to:

I created a subdomain.


I'll bet it is a register_globals issue. Try this instead:

<?php
if ($REQUEST_METHOD == "POST") {
$txtname = strip_tags($_POST['txtname']);
$txtcompany = strip_tags($_POST['txtcompany']);
$txtemail = strip_tags($_POST['txtemail']);
$txtcomments = strip_tags($_POST['txtcomments']);

$sendto = "xxxxx@xxxxxx.com";
$subject = "Contact Form";
$message = "Sender's Name: $txtnamenEmail: $txtemailnSender's Website: $txtcompanynnMessage:n $txtcomments";

mail($sendto, $subject, $message);
}
?>

Just as an FYI - you aren't really doing enough to protect this form script from things like header injection. Also, since you are using double quotes in your $message assignment line, you have no need for all the concatenation (I've removed it from my version).

Re: php mail under subdomains

Posted by: sdayman
Posted on: 2006-11-19 10:36:00

If it's register_globals, why does it work in one domain, but not in the other (sub)domain?

-Scott

Re: php mail under subdomains

Posted by: scjessey
Posted on: 2006-11-19 17:45:00

In reply to:

If it's register_globals, why does it work in one domain, but not in the other (sub)domain?


It depends if you requested the subdomain to be "fully hosted" when you set it up. If you did, then it is a completely separate entity from its parent domain, and can thus have a different PHP setup.

Re: php mail under subdomains

Posted by: sdayman
Posted on: 2006-11-19 18:08:00

That makes sense. There was another thread with a similar issue between a production site and a much later created dev site.

-Scott

Tags: php mailmail functionsubdomainroot domainsubdomainscontact