php - Getting 500 Error when loading "send email" page -
sp trying send out email, code worked fine until switched on html email standard email.
it live here: http://kenthomes.net/amelia-cove
click "share plan".
my code is:
$person = $_post["name"]; //where pulling emails from? $emaildb = "emailaddresses"; $type = $_post["type"]; //get share url misformatted. $waybefore = $_get["share"]; $before = str_replace("*", "?", $waybefore); $shareme = str_replace("!", "=", $before); $id = $_server['http_referer']; $id = $_server['http_referer']; //where want copy of email go to? (or null) $copydb = ""; if($_get["com"]) { $prettytype = "community"; } else if($_get["inv"]) { $prettytype = "move-in ready home"; } else if($_get["mod"]) { $prettytype = "model home"; } $_post["date"] = date("y-m-d"); $emails = new controller($emaildb, null, null, true); $ed = $emails->getdata(); // // stuff // $emailto = $_post["email"]; $subject = "kent homes - " . $person . " share " . ucwords(strtolower($_get['type'])) . " you!"; $out = '<html><body>'; $out .= $person . " thought " . $prettytype . " kent homes. click link view: http://kenthomes.net" . $shareme . "</br></br>"; $out .= "additional message " . $person . "</br>"; $out .= $_post['msg']; $out .= '</body></html>'; $headers = "from: " . $person "<noreply@kenthomes.com>\r\n"; $headers .= "reply-to: <noreply@kenthomes.com\r\n"; $headers .= "x-mailer: php/" . phpversion()."\r\n"; $headers .= "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n"; // // send 'er off! // mail($emailto, $subject, $out, $headers); if($toemail) { mail($emailto, $subject, $out, $headers); } echo "<p>this " . ucwords(strtolower($_get['type'])) . " has been sent " . $_post["email"] . ".</p>"; unset($_post["id"]);
i getting error:
http error 500 (internal server error): unexpected condition encountered while server attempting fulfill request.
this functioning code looks before html mail stuff:
$captcha = new mcaptcha(); if($_post["submitit"]) { $answer = $captcha->checkanswer(); if($answer) { $person = $_post["name"]; $emailto = $_post["email"]; $subject = "kent homes - " . $person . " share " . ucwords(strtolower($_get['type'])) . " you!"; //where pulling emails from? $emaildb = "emailaddresses"; $type = $_post["type"]; //get share url misformatted. $waybefore = $_get["share"]; $before = str_replace("*", "?", $waybefore); $shareme = str_replace("!", "=", $before); $id = $_server['http_referer']; $id = $_server['http_referer']; //where want copy of email go to? (or null) $copydb = ""; if($_get["com"]) { $prettytype = "community"; } else if($_get["inv"]) { $prettytype = "move-in ready home"; } else if($_get["mod"]) { $prettytype = "model home"; } $out = $person . " thought " . $prettytype . " kent homes. click link view: http://kenthomes.net" . $shareme . " "; $_post["date"] = date("y-m-d"); $emails = new controller($emaildb, null, null, true); $ed = $emails->getdata(); mail($emailto, $subject, $out, $headers); if($toemail) { mail($emailto, $subject, $out, $headers); } echo "<p>this " . ucwords(strtolower($_get['type'])) . " has been sent " . $_post["email"] . ".</p>"; unset($_post["id"]); } }
i don't see problems code cause 500. unseen items cause 500:
- is 'controller' included , defined?
- does happen in constructing of controller cause 500?
- is there syntax error in code removed make snippet?
to start with, check apache logs. in ubuntu, they're typically in /var/log/apache2/error.log. if nothing prints in error log, it's possible you're running out of memory or time. doubt case, if is, these help:
ini_set('memory_limit', '1g'); set_time_limit(3600);
they diagnose, want configure runtime use case.
if print in error log, investigate - it's issue.
if none of help, try dying in middle of script see how far gets. offending piece of code, die on own without printing out die message.
die("got here");
Comments
Post a Comment