Php mail under subdomains


#1

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.


#2

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


#3

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: " . "$txtname\n" . "Email: " . "$txtemail\n" . "Senders Website: " . "$txtcompany\n\n" . "Message:\n " . "$txtcomments"; mail($sendto, $subject, $message); } ?>

Thanks.


#4

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


#5

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

[code]<?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: $txtname\nEmail: $txtemail\nSender’s Website: $txtcompany\n\nMessage:\n $txtcomments”;

mail($sendto, $subject, $message);
}
?>[/code]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).


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#6

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

-Scott


#7

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.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#8

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

-Scott