Jump to content

mail function server problem


ktretter

Recommended Posts

Hi, i'm new to php. I have a mail function form script. The script works fine on my schools server and sends messages instantly. However I signed up for brinkster hosting and it takes a few days to send, if it ever sends.
Here is my code. Thanks for any help.

<?PHP


error_reporting(7);


if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}

# RegisterGlobals OFF

$FTGfirst = $_POST['first'];
$FTGlast = $_POST['last'];
$FTGemail = $_POST['email'];
$FTGdob = $_POST['dob'];
$FTGpaNum = $_POST['paNum'];
$FTGphNum = $_POST['phNum'];
$FTGphFax = $_POST['phFax'];
$FTGpre = $_POST['pre'];
$FTGquan = $_POST['quan'];
$FTGdate = $_POST['date'];


if (get_magic_quotes_gpc) {
$FTGfirst = stripslashes($FTGfirst);
$FTGlast = stripslashes($FTGlast);
$FTGemail = stripslashes($FTGemail);
$FTGdob = stripslashes($FTGdob);
$FTGpaNum = stripslashes($FTGpaNum);
$FTGphNum = stripslashes($FTGphNum);
$FTGphFax = stripslashes($FTGphFax);
$FTGpre = stripslashes($FTGpre);
$FTGquan = stripslashes($FTGquan);
$FTGdate = stripslashes($FTGdate);
}
# Redirect user to the error page

if ($validationFailed == true) {

header("Location: error.html");
exit;

}

# Email to Form Owner

$emailTo = '[email protected]';

$emailSubject = "Prescription Request";
$emailSubject = preg_replace('/[\x00-\x1F]/', '', $emailSubject);

$emailFrom = "$FTGemail";
$emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom);

$emailBody = "First Name: $FTGfirst\n"
. "Last Name: $FTGlast\n"
. "Email Address: $FTGemail\n"
. "Date of Birth: $FTGdob\n"
. "Patient Phone Number: $FTGpaNum\n"
. "Pharmacy Phone Number: $FTGphNum\n"
. "Pharmacy Fax Number: $FTGphFax\n"
. "Prescription: $FTGpre\n"
. "Quantity: $FTGquan\n"
. "Date of Last Refill: $FTGdate\n"
. "\n"
. "";

$emailHeader = "From: $emailFrom\n"
. "Reply-To: $emailFrom\n"
. "MIME-Version: 1.0\n"
. "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-transfer-encoding: 8bit\n";

mail($emailTo, $emailSubject, $emailBody, $emailHeader);

echo <<<END

<<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Stella Maris Internal Medicine</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="topLine">
      <hr>
</div>


<div id="banner">
<img src="logo.png">
</div>

<div id="lowerLine">
      <hr>
</div>


<div id="navigation">
    <table>
<tr cellpadding="0" cellspacing="0">

<td><a href="index.html" class="nav"><img src="homeButton.png"></a></td>
<td><a href="prescription.html" class="nav"><img src="preButton.png"></a></td>
<td><a href="appointment.html" class="nav"><img src="appButton.png"></a></td>
<td><a href="health.html" class="nav"><img src="hButton.png"></a></td>
<td><a href="directions.html" class="nav"><img src="lButton.png"></a></td>
<td><a href="diets.html" class="nav"><img src="dButton.png"></a></td>
<td><a href="cv.html" class="nav"><img src="cButton.png"></a></td>



</tr>
</table>
</div>

<div id="leftBody">

</div>
<div id="rightBody">


<center>
<table>

<br>
Thank you for requesting a prescription. You will recieve a confirmation email when your request is processed.
For record keeping purposes your information is given below.

<table>
<br><br>
  <tr><td>First Name:</td><td> $FTGfirst </td></tr>
  <tr><td>Last Name:</td><td> $FTGlast </td></tr>
  <tr><td>Email Address:</td><td> $FTGemail </td></tr>
  <tr><td>Date of Birth:</td><td> $FTGdob </td></tr>
  <tr><td>Patient Phone Number:</td><td> $FTGpaNum </td></tr>
  <tr><td>Pharmacy Phone Number:</td><td> $FTGphNum </td></tr>
  <tr><td>Pharmacy Fax Number:</td><td> $FTGphFax </td></tr>
  <tr><td>Prescription:</td><td> $FTGpre </td></tr>
  <tr><td>Quantity:</td><td> $FTGquan</td></tr>
  <tr><td>Date of Last Refill:</td><td> $FTGdate </td></tr>




</table>

</center>



</div>

<div id="bottomLine">
      <hr>
</div>
<div id="policy">
<center> <a href="hipaa.html"> Hipaa Policy</a></center>
</div>
</body>
</html>
END;
?>
Link to comment
https://forums.phpfreaks.com/topic/18606-mail-function-server-problem/
Share on other sites

PHP's mail() function relies on sendmail, which may not be working correctly on the host's server. You could email them about this and might get their help, or, you could use an SMTP class, such as PHPMAILER (which Ive used and it's easy and great) to route messages to an SMTP mail server, instead of using sendmail, which in my experience, can be unreliable.

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.