Jump to content

500 Internal server error when using mail();


rondog

Recommended Posts

Hi,

I have a simple email.php file that looks like:

<?php
mail("myemail","mysubject","mymsg");
?>

That file works just fine. I receive everything. My real file is a little more complicated. I am using header options which may be why I am getting this error.

 

Here is my entire file. It looks like a lot, but its really just a big msg being sent. When I open the file I get 500 Internal server Error. If I comment out the mail functions, the file works. Can any of you see what is wrong with this picture?

<?php
/* This file submits data to the database including page views, wrong answers, certificates generated, and all of the users information.*/
include 'connect.php';
$done = false;
$title = $_POST['theTitle'];
$name = $_POST['theName'];
$account = $_POST['theCurAct'];
$subtitle = $_POST['theSubTitle'];
$address1 = $_POST['theAdd1'];
$address2 = $_POST['theAdd2'];
$city = $_POST['theCity'];
$state = $_POST['theState'];
$zip = $_POST['theZip'];
$phone = $_POST['thePhone'];
$email = $_POST['theEmail'];
$testNum = $_POST['theTestNumber'];
//wrong answer array
$wrongAnswers = $_POST['wrongs'];
$wrongAnswers_arr = explode(",",$wrongAnswers);
$done = true;
if($done == true) {
if($accountWasNo == true) {
	echo "&msgText=success";
	$headers = "From: email@email.com\n";
	$headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
	$headers .= "MIME-Version: 1.0 ";
	$date = date("m.d.y, g:i a");
	$pmsg = "A user has just completed the SynergEyes® PS Practitioner training certification program<br/><br/>";
	$pmsg .= "Date/Time: $date<br/>";
	$pmsg .= "Title: $title<br/>";
	$pmsg .= "Full Name: $name<br/>";
	$pmsg .= "Account: $account<br/>";
	$pmsg .= "Sub Title: $subtitle<br/>";
	$pmsg .= "Address 1: $address1<br/>";
	$pmsg .= "Address 2: $address2<br/>";
	$pmsg .= "City: $city<br/>";
	$pmsg .= "State: $state<br/>";
	$pmsg .= "Zip: $zip<br/>";
	$pmsg .= "Phone: $phone<br/>";
	$pmsg .= "Email: <a href=\"mailto:$email\">$email</a><br/>";
	mail("email@email.com","Next Steps to Prescribe SynergEyes® Multifocal",$pmsg,$headers);
	mail("email@email.com","Next Steps to Prescribe SynergEyes® Multifocal",$pmsg,$headers);
	$msg = "<b>Congratulations $name</b><br/>";
	$msg .= "You have successfully completed the SynergEyes® Multifocal training certification program. If you currently have an active account with SynergEyes, you will now be designated as a \"Certified Multifocal Fitter\" on the doctor locator portion of <a href=\"http://www.synergeyes.com\">www.synergeyes.com</a>.<br/><br/>";
	$msg .= "If you do not have an active SynergEyes account, please download and complete the Practice Prescribe It!™ Agreement and fax it back to SynergEyes at (877) 329-2012.<br/><br/>";
	$msg .= "<a href=\"http://www.dopmedia.com/hosted/synergeyes/prescribeitagreement.pdf\">Click here to download the SynergEyes® Practice Prescribe It!™ Agreement</a>.<br/><br/>";
	$msg .= "SynergEyes® Multifocal Trials Lens Sets are available; although they are not necessary to prescribe the lens. If you would like to have a Trial Lens Set, you have two options for obtaining one:  <ul><li>Fit 3 patients in SynergEyes® Multifocal lenses every quarter for 1 year and receive the Trial Lens Set FREE</li><li>Purchase the set for $899 with 30, 60, 90 day payment terms available</li></ul><br/>";
	$msg .= "As with all SynergEyes products, the Trial Lens Set is fully warranted for 90 days. To order the Trial Lens Set, please download and complete the Purchase Plan Agreement and fax it back to SynergEyes at (877) 329-2012.<br/><br/>";
	$msg .= "<a href=\"http://www.dopmedia.com/hosted/synergeyes/practitionerpurchaseagreement.pdf\">Click here to download the SynergEyes® Purchase Plan Agreement</a>.<br/><br/>";
	$msg .= "If you have any questions, please call Customer Care toll free at (877) 733-2012, option 1 or Consultation at (877) 733-2012, option 2.<br/><br/>";
	$msg .= "Thank you so much for your time and interest in fitting SynergEyes® Multifocal hybrid contact lens.<br/><br/><b>Welcome!</b><br/><br/>";
	mail($email,"Next Steps to Prescribe SynergEyes® Multifocal",$msg,$headers);
} elseif($accountWasYes == true) {
	echo "&msgText=success";
	$headers = "From: email@email.com\n";
	$headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
	$headers .= "MIME-Version: 1.0 ";
	$date = date("m.d.y, g:i a");
	$pmsg = "A user has just completed the SynergEyes® PS Practitioner training certification program<br/><br/>";
	$pmsg .= "Date/Time: $date<br/>";
	$pmsg .= "Title: $title<br/>";
	$pmsg .= "Full Name: $name<br/>";
	$pmsg .= "Account: $account<br/>";
	$pmsg .= "Sub Title: $subtitle<br/>";
	$pmsg .= "Address 1: $address1<br/>";
	$pmsg .= "Address 2: $address2<br/>";
	$pmsg .= "City: $city<br/>";
	$pmsg .= "State: $state<br/>";
	$pmsg .= "Zip: $zip<br/>";
	$pmsg .= "Phone: $phone<br/>";
	$pmsg .= "Email: <a href=\"mailto:$email\">$email</a><br/>";
	mail("email@email.com","Next Steps to Prescribe SynergEyes® Multifocal",$pmsg,$headers);
	mail("email@email.com","Next Steps to Prescribe SynergEyes® Multifocal",$pmsg,$headers);
	$msg = "<b>Congratulations $name</b><br/>";
	$msg .= "You have successfully completed the SynergEyes® Multifocal training certification program. If you currently have an active account with SynergEyes, you will now be designated as a \"Certified Multifocal Fitter\" on the doctor locator portion of <a href=\"http://www.synergeyes.com\">www.synergeyes.com</a>.<br/><br/>";
	$msg .= "If you do not have an active SynergEyes account, please download and complete the Practice Prescribe It!™ Agreement and fax it back to SynergEyes at (877) 329-2012.<br/><br/>";
	$msg .= "<a href=\"http://www.dopmedia.com/hosted/synergeyes/prescribeitagreement.pdf\">Click here to download the SynergEyes® Practice Prescribe It!™ Agreement</a>.<br/><br/>";
	$msg .= "SynergEyes® Multifocal Trials Lens Sets are available; although they are not necessary to prescribe the lens. If you would like to have a Trial Lens Set, you have two options for obtaining one:  <ul><li>Fit 3 patients in SynergEyes® Multifocal lenses every quarter for 1 year and receive the Trial Lens Set FREE</li><li>Purchase the set for $899 with 30, 60, 90 day payment terms available</li></ul><br/>";
	$msg .= "As with all SynergEyes products, the Trial Lens Set is fully warranted for 90 days. To order the Trial Lens Set, please download and complete the Purchase Plan Agreement and fax it back to SynergEyes at (877) 329-2012.<br/><br/>";
	$msg .= "<a href=\"http://www.dopmedia.com/hosted/synergeyes/practitionerpurchaseagreement.pdf\">Click here to download the SynergEyes® Purchase Plan Agreement</a>.<br/><br/>";
	$msg .= "If you have any questions, please call Customer Care toll free at (877) 733-2012, option 1 or Consultation at (877) 733-2012, option 2.<br/><br/>";
	$msg .= "Thank you so much for your time and interest in fitting SynergEyes® Multifocal hybrid contact lens.<br/><br/><b>Welcome!</b><br/><br/>";
	mail($email,"Next Steps to Prescribe SynergEyes® Multifocal",$msg,$headers);
} else {
	echo "&msgText=Error";
}
}
?>

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.