Jump to content

Recommended Posts

Hey, guys. The mail() function will not work for me and I was wondering if anyone could tell me why...

 

contact.php

<?php 
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<title>Contact Us</title>


<link rel="stylesheet" type="text/css" href="/style.css" />
<link rel="shortcut icon" href="/fav.png">

<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style-ie.css" />
<![endif]-->
<script type="text/javascript">
function cacherVoir(theDIV){
leStyle = document.getElementById(theDIV).style ;
if(leStyle.display == "block") {
leStyle.display = "none";
}
else{
leStyle.display = "block";
}
}
</script> 
<meta name="verify-v1" content="LiYZqvPLQLMOR/3+Stk2cMxWr2l80SisI86GjbuNmLU=" >
<style type="text/css">
#header{
margin:0 auto;
}
#container{
background: #4b4214 url() repeat-y scroll 0 0;
overflow:hidden;
margin:0 auto;
width:82%;
}
#left-sidebar{
margin-left:0;
padding-left:50px;
width:150px;
float:left;
padding-top:20px;
}
#main-content{
width:62%;
margin-left:0;
padding-left:80px;
float:left;
padding-right:0;
}
#footer{margin:0 auto;}
</style>

</head>

<body>


<div id="page-wrap">

<div id="inside">

<div id="header">
<?php 
include "button.php";
?>
</div>

<div style="clear:both;"></div>
<div id="container">

<div id="left-sidebar">


<p>				
<?php 
include "home.php";
?><br/>
<a href="http://mythscape.freezoka.com/wiki//index.php?MythScapeMainPage" target="_blank">Wiki</a></div>

</p>




<div id="main-content">
<a href="index.php">Home</a><br/>

<form method="post" action="sendeail.php">
<fieldset> 
<legend>Contact Form</legend> 
<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Subject:<br />
<select name="attn" size="1">
<option value=" Help ">Help </option>
<option value=" Comments ">Comments </option>
<option value=" Feedback ">Feedback </option>
<option value=" Suggestions ">Suggestions </option>
<option value=" General Question ">General Question </option>
<option value=" Unspecified ">Other </option>
</select>
<br /><br />
Content <br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Submit" />
</fieldset></form>
<br />
</div>	
</div>
<div style="clear: both;"></div>


<?php 
include "footer.php"; 
?></p>
</div></div>

<div style="clear: both;"></div>

</div>

</body>

</html>

 

sendeail.php

<?php 
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<title>Send Email</title>


<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" href="fav.png">

<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style-ie.css" />
<![endif]-->
<script type="text/javascript">
function cacherVoir(theDIV){
leStyle = document.getElementById(theDIV).style ;
if(leStyle.display == "block") {
leStyle.display = "none";
}
else{
leStyle.display = "block";
}
}
</script> 
<meta name="verify-v1" content="LiYZqvPLQLMOR/3+Stk2cMxWr2l80SisI86GjbuNmLU=" >
<style type="text/css">
#header{
margin:0 auto;
}
#container{
background: #4b4214 url() repeat-y scroll 0 0;
overflow:hidden;
margin:0 auto;
width:82%;
}
#left-sidebar{
margin-left:0;
padding-left:50px;
width:150px;
float:left;
padding-top:20px;
}
#main-content{
width:62%;
margin-left:0;
padding-left:80px;
float:left;
padding-right:0;
}
#footer{margin:0 auto;}
</style>

</head>

<body>


<div id="page-wrap">

<div id="inside">

<div id="header">
<?php 
include "button.php";
?>
</div>

<div style="clear:both;"></div>
<div id="container">

<div id="left-sidebar">


<p><?php 
include "home.php";
?><br/>
<a href="http://mythscape.freezoka.com/wiki//index.php?MythScapeMainPage" target="_blank">Wiki</a></div>

</p>




<div id="main-content"><?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2><a href='contact.php'>Enter valid e-mail</a></h2>\n";
$badinput = "<h2>Query was NOT submitted</h2>\n";
echo $badinput;
die ("");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2><a href='contact.php'>Fill in all fields!</a></h2>\n";
die ("");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("predhead9@yahoo.com", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Subject: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>

<br /><br />
<a href="contact.php"> Send Another </a> | <a href="index.php">Home</a>
</p> 
</div>	
</div>
<div style="clear: both;"></div>

<div id="footer">

<p><?php 
include "footer.php"; 
?></p>
</div></div>

<div style="clear: both;"></div>

</div>

</body>

</html>

 

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/164697-mail-not-working/
Share on other sites

I did that. No luck. The emails never even showed up in my Yahoo or my GMail.

 

 

EDIT: The change in the PHP echoed "Mail Sent", which is good, let's see if I can get it. :D

 

EDIT #2: I didn't get it, this time I tried Yahoo, GMail, and my School Email Address. No luck.

Link to comment
https://forums.phpfreaks.com/topic/164697-mail-not-working/#findComment-868836
Share on other sites

Do you have access to the mail logs on your server??

 

If the script is saying its sent then it's being blocked somewhere.

 

If you do not have access to the mail logs ask your web host to take a look at the mail log to determine if the message is successfully leaving their network or not.

 

If it is then the issue is with the recipient mail server, probably your junk mail folder.

Link to comment
https://forums.phpfreaks.com/topic/164697-mail-not-working/#findComment-868839
Share on other sites

I have this problem with freehosts all the time. I know for a fact that freehostia blocks all email sending from freehosted websites, even though the mail() command returns true. If you are using shared hosting of any kind, ask their tech support if they block this kind of thing.

Link to comment
https://forums.phpfreaks.com/topic/164697-mail-not-working/#findComment-868870
Share on other sites

I checked my Spam folders, but it wasn't there.  :-\

 

I am using a free webhost, maybe that's the problem, if that's the case, that is bad. But I checked something a while back that said emails were allowed...maybe I was looking at the wrong thing. I'll try and contact the host, and I'll try to change the header.

 

 

Thanks, guys. :)

Link to comment
https://forums.phpfreaks.com/topic/164697-mail-not-working/#findComment-868940
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.