aaronfenker Posted April 20, 2007 Share Posted April 20, 2007 I'm trying to use the mail() function to send an email containing a table, but it keeps failing. I'm not sure what the problem is. It doesn't throw any syntax errors in terminal. My code is below: $to = ********@gmail.com" . ","; $to .= "********@gmail.com"; $subject = $_POST['firstnamecheck'] . " " . $_POST['lastnamecheck'] . " RSVPed"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: " . $_POST['firstnamecheck'] . " " . $_POST['lastnamecheck'] . "\r\n\r\n"; $headers .= $_POST['firstnamecheck'] . " " . $_POST['lastnamecheck'] . "has registered for the wedding.\r\n\r\n<b>Contact Information:</b>\r\n"; $message = "<html><table><tr><td align='left'>" . $_POST['firstnamecheck'] . " " . $_POST['lastnamecheck'] . "</td></tr><tr><td align='left'>" . $_POST['add1check'] . "</td></tr><tr><td align='left'>" . $_POST['add2check'] . "</td></tr><tr><td align='left'>" . $_POST['citycheck'] . "," . $_POST['statecheck'] . " " . $_POST['zipcheck'] . "</td></tr><tr><td align='left'></td></tr><tr><td align='left'>Response:" . $_POST['respcheck'] . "</td></tr><tr><td align='left'>Adults:" . $_POST['adultscheck'] . "</td></tr><tr><td align='left'>Children" . $_POST['childrencheck'] . "</td></tr></table></html>"; mail($to, $subject, $message, $headers) or die("<td class=\"content\" valign=\"top\">ERROR!!! <br /> PLEASE CONTACT THE BRIDE AND GROOM IMMEDIATELY!</td>"); Link to comment https://forums.phpfreaks.com/topic/47948-php-mail-error/ Share on other sites More sharing options...
kenrbnsn Posted April 21, 2007 Share Posted April 21, 2007 What do you mean it's failing? Ken Link to comment https://forums.phpfreaks.com/topic/47948-php-mail-error/#findComment-234389 Share on other sites More sharing options...
aaronfenker Posted April 21, 2007 Author Share Posted April 21, 2007 By failing I mean that it doesn't execute mail(), but instead executes die(). However, when I check the code in Terminal (I'm on a mac) it doesn't throw a syntax error. So I know that isn't the problem; therefore, I have no idea what the problem is. Link to comment https://forums.phpfreaks.com/topic/47948-php-mail-error/#findComment-234765 Share on other sites More sharing options...
aaronfenker Posted April 22, 2007 Author Share Posted April 22, 2007 I figured out what was wrong. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/47948-php-mail-error/#findComment-235032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.