Jump to content

PHP mail() issue


hosker

Recommended Posts

I get the following warning when submitting a form. Up until yesterday the mail() function had no issues sending out the email.

 

Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\6027795\html\demo\submit.php on line 125

 

Here is my code:

<?php
define('INCLUDE_CHECK',false);

// require 'connect.php';
// require 'functions.php';
// Those two files can be included only if INCLUDE_CHECK is defined
require_once './core/gear/SessionGear.php';
require_once './core/gear/UserProfileGear.php'; 
require_once './core/gear/SearchGear.php';
  
// This is required for Login status
$accessrights=array ('s');
include 'defender.php';

// Gets the Current Logged in User
$sessionid='';
if (isset($_COOKIE['sessionid'])) {
$sessionid=$_COOKIE['sessionid'];	}
$userid= SessionGear::getInstance()->getUserForSession($sessionid); 


// Pulls out users email to store it in the form
$sql="SELECT `username`,`role`,`status`,`fname`,`lname`,`email` FROM
        `clp_user` WHERE `username`='$userid'";
        $userprof=mysql_query($sql);
        $countToCheck=0;
        if ($userprof) {
        $countToCheck=mysql_num_rows($userprof);
        } else {
            $countToCheck=0;
        }

        $userdetail=array("username"=>"","role"=>"","status"=>"",
            "fname"=>"","lname"=>"","email"=>"");
        if ($countToCheck) {
            while ($row=mysql_fetch_assoc($userprof)) {
                $userdetail['username']=$row['username'];
                $userdetail['role']=$row['role'];
                $userdetail['status']=$row['status'];
                $userdetail['fname']=$row['fname'];
                $userdetail['lname']=$row['lname'];
                $userdetail['email']=$row['email'];
            }
        }

?>

<!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>
<title>Welcome to Chubsters Golf & Country Club</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" media="all" type="text/css" href="css/index.css" />


</head>
  

<body>

<div id="header">
</div>

<div> <?php include("includes/menu.php"); ?> </div>





<?PHP


/* Database config */

$db_host		= '';
$db_user		= '';
$db_pass		= '';
$db_database	= ''; 

/* End config */



$link = mysql_connect($db_host,$db_user,$db_pass) or die('Unable to establish a DB connection');

mysql_select_db($db_database,$link);
mysql_query("SET player UTF8");
$usr = $userid;
$golfer = $_REQUEST['golfer'];
$tournament = $_REQUEST['tournament'];
$backup = $_REQUEST['backup'];
date_default_timezone_set('US/Eastern');
$time = date("Y-m-d H:i:s");

echo $t_id; echo "<br />";
echo $tournament; echo "<br />";
echo $usr; echo "<br />";
echo $golfer; echo "<br />";
echo $backup; echo "<br />";
echo $time; echo "<br />";
echo $userdetail['email']; echo "<br />";

//$sql = "SELECT * FROM weekly_picks WHERE tournament = '$tournament' AND usr = '$usr'";
//$result = mysql_query($sql);
//echo mysql_num_rows($result);

//if	($num > 0)
//	mysql_query("UPDATE weekly_picks SET player = '$golfer' WHERE tournament = '$tournament' AND user = '$usr'");
//else
mysql_query("INSERT INTO weekly_picks (t_id, tournament, user, player, backup, timestamp) VALUES ('$t_id', '$tournament', '$usr', '$golfer', '$backup', '$time')",$link) or die('Error, insert query failed');



$to = $userdetail['email'];
$subject = "Weekly Tournament Pick for: $tournament";
$message = "This email is to confirm your pick for $tournament has been received.
Your pick is: $golfer.
Your backup pick is: $backup 
The time it was submitted was $time 
Do not reply to this email, the mailbox does not exist. 
Contact me with any issues at bradthornhill@yahoo.com";

$from = "noreply@chubstersgcc.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
?>

<div>
<p>This is to confirm that your pick has been submitted for the following tournament: <?php echo $tournament; ?>. A confirmation of your pick as also been emailed to you.</p>
<p>Your golfer: <?php echo $golfer; ?></p>
<p>Your backup: <?php echo $backup; ?></p>
<p>Your pick was submitted at: <?php echo $time; ?></p>
</div>


<div>
<p>This is the footer</p>
</div>

</body>
</html>

 

 

Any ideas as to what I can do to fix this issue? I have hosting with GoDaddy on a windows hosting plan.

Link to comment
Share on other sites

something has changed in your code then, before I glance at your code I must ask, have you looked at the line of code that the error is referring to?

have you tried using simple syntax to send mail to make sure that it is not an SMTP error? mail('you@youraddress.com','subject','message');

Link to comment
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.