PHP mail/contact script misbehaving...
Posted: Sun Jul 15, 2007 6:27 pm
feyd | Please use
The PHP script looks like:[/syntax]
Everything works great, and the emails come to me with a return address of "webmaster@bigbrass.com". The store itself is hosted on Yahoo.
I tried hijacking the form/code and integrating it into one of my other sites:
http://www.prepresspros.com/contact.html
The code in the page looks like:
The PHP script looks like:
There are only a couple areas I tweaked, namely those to do with destination email, script location, subject line and "thank you" page location. As far as I can tell, no code was altered.
The emails from this script come to me with a return email address of "anonymous@72-4-174-76.ptr.primarydns.com", and the user-supplied fields (Email, Name, Message) are all blank. Problems would be the odd return email address, and the fact that the user-supplied fields are blank. I'd also like to remove the default subject ("Contact from Prepress Pros website"), as it's also being placed in the Subject field in the user-supplied data area. Actually, with this problem script, that's the only piece of info that comes through.
What am I missing here? Thank you very much in advance for your time...
...Dave
p.s. Thanx to Feyd for cleaning up my post. I don't think I could've done that even if I tried. I've never had to use PHP before, and was only able to work with this code because someone first implemented it, then I went in and changed things that looked familiar to me (email addresses, http locations, etc.).
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello...
I've spent some time pecking around in the forums, using the search, and not finding a specific instance of the problem I'm having. Perhaps I'm missing something, or maybe this bug's an odd one.
I have a PHP contact form on my website:
[url]http://www.bigbrass.com/contact.html[/url]
The code in the page looks like:
[syntax="html"]<form action="http://site.bigbrass.com/forms/email-comments.php" method="post">
<table cellpadding="0" cellspacing="5" border="0">
<tr valign="top">
<td><b>Email:</b></td><td><input type="text" name="email" size="21"></td>
</tr><tr valign="top">
<td><b>Name:</b></td><td><input type="text" name="name" size="21"></td>
</tr><tr valign="top">
<td><b>Subject:</b></td><td><input type="text" name="subject" size="21"></td>
</tr><tr valign="top">
<td><b>Message:</b></td><td><textarea cols="30" rows="6" name="message"></textarea></td>
</tr>
<tr valign="top">
<td> </td><td><input id="subscribe" type="submit" value=" Submit "></td>
</table>
</form>Code: Select all
<?php
$to = "info@bigbrass.com";
$subject = "Contact Us from Website";
$message =
"Email: $email\n
Name: $name\n
Subject: $subject\n
Message: $message\n
" ;
if (mail($to, $subject, $message)) {
header('Location: http://store.bigbrass.com/contact-thankyou.html');
exit();
} else {
echo "There was an error while sending the comments.";
}
?>I tried hijacking the form/code and integrating it into one of my other sites:
http://www.prepresspros.com/contact.html
The code in the page looks like:
Code: Select all
<form action="http://www.prepresspros.com/forms/email-comments.php" method="post">
<table cellpadding="0" cellspacing="5" border="0">
<tr valign="top">
<td><b>Email:</b></td><td><input type="text" name="email" size="35"></td>
</tr><tr valign="top">
<td><b>Name:</b></td><td><input type="text" name="name" size="35"></td>
</tr><tr valign="top">
<td><b>Subject:</b></td><td><input type="text" name="subject" size="35"></td>
</tr><tr valign="top">
<td><b>Message:</b></td><td><textarea cols="35" rows="8" name="message"></textarea></td>
</tr>
<tr valign="top">
<td> </td><td><input id="subscribe" type="submit" value=" Submit "></td>
</table>
</form>Code: Select all
<?php
$to = "pros@prepresspros.com";
$subject = "Contact from Prepress Pros website";
$message =
"Email: $email\n
Name: $name\n
Subject: $subject\n
Message: $message\n
" ;
if (mail($to, $subject, $message)) {
header('Location: http://www.prepresspros.com/thankyouinset.html');
exit();
} else {
echo "There was an error while sending the comments.";
}
?>The emails from this script come to me with a return email address of "anonymous@72-4-174-76.ptr.primarydns.com", and the user-supplied fields (Email, Name, Message) are all blank. Problems would be the odd return email address, and the fact that the user-supplied fields are blank. I'd also like to remove the default subject ("Contact from Prepress Pros website"), as it's also being placed in the Subject field in the user-supplied data area. Actually, with this problem script, that's the only piece of info that comes through.
What am I missing here? Thank you very much in advance for your time...
...Dave
p.s. Thanx to Feyd for cleaning up my post. I don't think I could've done that even if I tried. I've never had to use PHP before, and was only able to work with this code because someone first implemented it, then I went in and changed things that looked familiar to me (email addresses, http locations, etc.).
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]