Jump to content

mail function used to work....now it doesnt


kjmeath

Recommended Posts

I am using the mail function  in a contact form and it used to work correctly, but for some reason it is not working anymore...the domain is:

http://www.zistyle.info/cultivatedcloset/contact.php

heres the code (please dont comment on its quality, i already know it needs a few improvements...i still have some revamping to do on it, but it did work 3 days ago....)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
<?php
if ( count($_POST) > 0){
if ($first_name == "" ){
	$tar1= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink></span> PLEASE ENTER YOUR <span class=\"a7\">FIRST NAME</span>";
	}
elseif ($last_name == ""){
	$tar2= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink></span> PLEASE ENTER YOUR <span class=\"a7\">LAST NAME</span>";
	}
elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email1)) {
	$tar3= "<span class=\"a7\"><blink>*</blink></span>";
	$tar4= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink> INVALID EMAIL ADDRESS</span>";
}
elseif ($email1 != $email2 ) {
	$tar3= "<span class=\"a7\"><blink>*</blink></span>";
	$tar4= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink> EMAILS DO NOT MATCH</span>";
}
elseif ($themessage == ""){
	$tar5= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink> PLEASE ENTER A MESSAGE</span>";
}
else {
	$name= "$first_name $last_name \n";
$re="Hey Zi, $name sent you a message from the zistyle.info website. \n";
$body ="$re \n";
$body.="$first_name wrote: \n";
$body.="$themessage \n \n";
$body.="$first_name's email is: $email1 \n";
mail("$email1", "Auto-reply from Zi Ata", "Thank you $first_name, \n I will reply to your message by contacting you through your $email1 email address, please allow up to 72 hours for a response to your message: \"$themessage\" \n once again \n Thank You \n \n Zi Ata");
mail("[email protected]", "Zi, $name sent you a message from the zistyle.info website", $body);
header("Location: thankyou.html");
}
}
else {
$message="<span class=\"a7\"><blink>*</blink></span> Be sure to fill in the all required fields <span class=\"a7\"><blink>*</blink></span>";
}
?>
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Zi Style</title>
<link rel="stylesheet" href="css.css" type="text/css" />
</head>
<body id="backgroundcolor">
<a name="top"></a>
<div align="center" id="headerbox">A Cultivated Closet</div>
<div id="navcontainer">
	<ul id="navlist">
	<li><a href="index.html">About</a></li>
	<li><a href="biography.html">Biography</a></li>
	<li><a href="process.html">The Process</a></li>
	<li><a href="pricing.html">Pricing</a></li>
	<li><a href="portfolio.html">Portfolio</a></li>
	<li><a href="calendar.html">Calendar</a></li>
	<li id="active"><a href="contact.php" id="current">Contact</a></li>
	</ul>
</div>
<div id="content">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div align="center">
<div id="a5">-Contacting Zi Ata-
</div>
<br />
<table width="550px" cellspacing="0" cellpadding="0">
<tr>
<td>	
<div align="center">
<table width="400" cellspacing="0" cellpadding="1">
	<tr>
		<th colspan="2" align="left">
				<?php echo $message; ?>
		</th>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please Enter Your
							<span class="a7"> First Name
							</span>
						</div>
					</td>
					<td>
						<?php echo $tar1; ?>
							<input type="text" name="first_name" value="<?php echo $_POST['first_name']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please Enter Your
							<span class="a7"> Last Name
							</span>
						</div>
					</td>
					<td>
						<?php echo $tar2; ?>
							<input type="text" name="last_name" value="<?php echo $_POST['last_name']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please Enter Your
							<span class="a7"> Email Address
							</span>
						</div>
					</td>
					<td>
						<?php echo $tar3; ?>
							<input type="text" name="email1" value="<?php echo $_POST['email1']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
		<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please
							<span class="a7"> Verify
							</span> Your Email Address
						</div>
					</td>
					<td>
						<?php echo $tar4; ?>
							<input type="text" name="email2" value="<?php echo $_POST['email2']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="400px" align="center">
							<?php echo $tar5; ?>
							<span class="a7"> Enter your message below
							</span>
					</td>
				</tr>
			</table>
		</td>
	</tr>
		<tr>
		<td colspan="2">
		<table width="500" border="0" cellspacing="0" cellpadding="0">
          		<tr>
	       		<td width="5000" align="center">
		   			<textarea name="themessage" rows="7" cols="50"><?php echo $_POST['themessage']; ?></textarea>
				</td>
			</tr>
		</table>		
		</td>
		</tr>
	<tr>
		<td colspan="2" align="center">
			<input name="submit" type="submit" value="Send" />
			<input name="reset" type="reset" value="Reset" />
		</td>
	</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</form>
</div>
<div id="mainimg"></div>
<div align="center">
<br />
<span class="a3">
	<a href="../">Home</a>
		<span class="a4">-</span>
	<a href="index.html">About</a>
		<span class="a4">-</span>
	<a href="biography.html">Biography</a>
		<span class="a4">-</span>
	<a href="process.html">The Process</a>
		<span class="a4">-</span>
	<a href="pricing.html">Pricing</a>
		<span class="a4">-</span>
	<a href="portfolio.html">Portfolio</a>
		<span class="a4">-</span>
	<a href="calendar.html">Calendar</a>
		<span class="a4">-</span>
	<a href="contact.php">Contact</a>
		<span class="a4">-</span>
	<a href="../stageright/">Stage Right</a>
</span>
</div>
<div align="center">
<span class="a1">© 2007 Zi Style</span>
</div>
<br />
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/58020-mail-function-used-to-worknow-it-doesnt/
Share on other sites

okay i changed the code, which has not made a change...heres thenew code:

<?php
if ( count($_POST) > 0){
if ($first_name == "" ){
	$tar1= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink></span> PLEASE ENTER YOUR <span class=\"a7\">FIRST NAME</span>";
	}
elseif ($last_name == ""){
	$tar2= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink></span> PLEASE ENTER YOUR <span class=\"a7\">LAST NAME</span>";
	}
elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email1)) {
	$tar3= "<span class=\"a7\"><blink>*</blink></span>";
	$tar4= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink> INVALID EMAIL ADDRESS</span>";
}
elseif ($email1 != $email2 ) {
	$tar3= "<span class=\"a7\"><blink>*</blink></span>";
	$tar4= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink> EMAILS DO NOT MATCH</span>";
}
elseif ($themessage == ""){
	$tar5= "<span class=\"a7\"><blink>*</blink></span>";
	$message="<span class=\"a7\"><blink>*</blink> PLEASE ENTER A MESSAGE</span>";
}
else {
	$name= "$first_name $last_name \n";
$re="Hey Zi, $name sent you a message from the zistyle.info website. \n";
$body ="$re \n";
$body.="$first_name wrote: \n";
$body.="$themessage \n \n";
$body.="$first_name's email is: $email1 \n";
mail("$email1", "Auto-reply from Zi Ata", "Thank you $first_name, \n I will reply to your message by contacting you through your $email1 email address, please allow up to 72 hours for a response to your message: \"$themessage\" \n once again \n Thank You \n \n Zi Ata");
mail("[email protected]", "Zi, $name sent you a message from the zistyle.info website", $body);
header("Location: thankyou.html");
}
}
else {
$message="<span class=\"a7\"><blink>*</blink></span> Be sure to fill in the all required fields <span class=\"a7\"><blink>*</blink></span>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Zi Style</title>
<link rel="stylesheet" href="css.css" type="text/css" />
</head>
<body id="backgroundcolor">
<a name="top"></a>
<div align="center" id="headerbox">A Cultivated Closet</div>
<div id="navcontainer">
	<ul id="navlist">
	<li><a href="index.html">About</a></li>
	<li><a href="biography.html">Biography</a></li>
	<li><a href="process.html">The Process</a></li>
	<li><a href="pricing.html">Pricing</a></li>
	<li><a href="portfolio.html">Portfolio</a></li>
	<li><a href="calendar.html">Calendar</a></li>
	<li id="active"><a href="contact.php" id="current">Contact</a></li>
	</ul>
</div>
<div id="content">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div align="center">
<div id="a5">-Contacting Zi Ata-
</div>
<br />
<table width="550px" cellspacing="0" cellpadding="0">
<tr>
<td>	
<div align="center">
<table width="400" cellspacing="0" cellpadding="1">
	<tr>
		<th colspan="2" align="left">
				<?php echo $message; ?>
		</th>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please Enter Your
							<span class="a7"> First Name
							</span>
						</div>
					</td>
					<td>
						<?php echo $tar1; ?>
							<input type="text" name="first_name" value="<?php echo $_POST['first_name']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please Enter Your
							<span class="a7"> Last Name
							</span>
						</div>
					</td>
					<td>
						<?php echo $tar2; ?>
							<input type="text" name="last_name" value="<?php echo $_POST['last_name']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please Enter Your
							<span class="a7"> Email Address
							</span>
						</div>
					</td>
					<td>
						<?php echo $tar3; ?>
							<input type="text" name="email1" value="<?php echo $_POST['email1']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
		<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="300px">
						<div align="left">Please
							<span class="a7"> Verify
							</span> Your Email Address
						</div>
					</td>
					<td>
						<?php echo $tar4; ?>
							<input type="text" name="email2" value="<?php echo $_POST['email2']; ?>" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="500px">
				<tr>
					<td width="400px" align="center">
							<?php echo $tar5; ?>
							<span class="a7"> Enter your message below
							</span>
					</td>
				</tr>
			</table>
		</td>
	</tr>
		<tr>
		<td colspan="2">
		<table width="500" border="0" cellspacing="0" cellpadding="0">
         		<tr>
	       		<td width="5000" align="center">
		   			<textarea name="themessage" rows="7" cols="50"><?php echo $_POST['themessage']; ?></textarea>
				</td>
			</tr>
		</table>		
		</td>
		</tr>
	<tr>
		<td colspan="2" align="center">
			<input name="submit" type="submit" value="Send" />
			<input name="reset" type="reset" value="Reset" />
		</td>
	</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</form>
</div>
<div id="mainimg"></div>
<div align="center">
<br />
<span class="a3">
	<a href="../">Home</a>
		<span class="a4">-</span>
	<a href="index.html">About</a>
		<span class="a4">-</span>
	<a href="biography.html">Biography</a>
		<span class="a4">-</span>
	<a href="process.html">The Process</a>
		<span class="a4">-</span>
	<a href="pricing.html">Pricing</a>
		<span class="a4">-</span>
	<a href="portfolio.html">Portfolio</a>
		<span class="a4">-</span>
	<a href="calendar.html">Calendar</a>
		<span class="a4">-</span>
	<a href="contact.php">Contact</a>
		<span class="a4">-</span>
	<a href="../stageright/">Stage Right</a>
</span>
</div>
<div align="center">
<span class="a1">© 2007 Zi Style</span>
</div>
<br />
</body>
</html>

Are you using linux? (postfix?)

 

Why dont you have a look at the mail log and see what it says, it may give you some useful info:

 

probably:

/var/log/mail.log (or something similar)

 

If you are using windows, then im not sure where the mail log is.

 

cheers,

tdw

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.