|
-
Feb 2nd, 2005, 07:17 AM
#1
[RESOLVED]What broke in my send mail script?
[EDIT]Nevermind guys.I figured everything out. Made it much cleaner and decided to use $_GET instead.
It worked when I first opened the website. Now, a few weeks later, everytime I try to send myself something it doesn't work. What broke?
The PHP (sendmail.php):
PHP Code:
<?php
//Options
$mailto = "[email protected]";
$subject = "Services Inquiry";
$redirect = "successmail.php";
$errordirect = "errormail.php";
$go = false;
//Put vars from form into the body of the e-mail
foreach($HTTP_POST_VARS as $key => $value) {
if($value == ""){
$go = false;
break;
}else if($key == "Submit"){
}else if($key == "Regards"){
$subject = $value;
}else{
$message .= $key . ': ' . $value;
$message .= "\n";
}
$go = true;
}
if($go)
{
if (@mail($mailto, $subject, $message, "From: BinaryIdiot.com Inquiry")) {
header("Location: $redirect");
} else {
header("Location: $errordirect");
}
}else{
header("Location: $errordirect");
}
?>
The XHTML (contact.php):
Code:
<form action="sendmail.php" method="post">
<p>Name: <input name="Name" type="text" size="25" maxlength="25" /></p>
<p>E-Mail: <input name="Email" type="text" size="25" maxlength="30" /></p>
<p>Subject: <input name="Regards" type="text" size="40" maxlength="40" /></p>
<p>Question/Comment/Suggestion/Inquiry:</p><p><textarea name="Message" cols="65" rows="14"></textarea></p>
<p><input name="Submit" type="submit" /><input name="Reset" type="reset" /></p>
</form>
Sorry for the dumb PHP questions but I learn best by working on projects and I've tried to figure this out myself and can't figure it out.
Last edited by Kasracer; Feb 2nd, 2005 at 08:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|