pokernarr Posted December 6, 2011 Share Posted December 6, 2011 first: Hi to all of you! Im new to this forum and registered because i had the following problem with the mail()-function i used the same code (header-code and mail-code) in another form where everything works well.. var_dumping the mail()'s result returns false (so its no mailer-side issue) What else shall i try? (i also tried \r\n instead of \n-only in the header-code) <?php $name = $sex."<br />".$name; $content = ""; if (isset($_POST['c1'])) {$content .= check_input($_POST['c1'])."<br />";} if (isset($_POST['c2'])) {$content .= check_input($_POST['c2'])."<br />";} if (isset($_POST['c3'])) {$content .= check_input($_POST['c3'])."<br />";} if (isset($_POST['c4'])) {$content .= check_input($_POST['c4'])."<br />";} if (isset($_POST['c5'])) {$content .= check_input($_POST['c5'])."<br />";} if (isset($_POST['c6'])) {$content .= check_input($_POST['c6'])."<br />";} if (isset($_POST['c7'])) {$content .= check_input($_POST['c7'])."<br />";} if (isset($_POST['c8'])) {$content .= check_input($_POST['c8'])."<br />";} if (isset($_POST['c9'])) {$content .= check_input($_POST['c9'])."<br />";} $string = "<div>".$name."<br />".$adress."<br />".$_POST['phone']."<br />".$email_from."</div>"; $string .= "<br /><p /><table width='100%' cellspacing='0' cellpadding='0'><tr><th valign='top' width='25%'>Ihr Wunschtermin</th><th valign='top' width='25%'>Alternative</th><th width='25%' valign='top'>Trainingsart</th><th valign='top'>Inhalte</th></tr>"; $string .= "<tr><td colspan='4'><hr></td></tr>"; $string .= "<tr align='center'><td valign='top'>".$date1."</td><td valign='top'>".$date2."</td><td valign='top'>".$training."</td><td valign='top'>".$content."</td></tr>"; $string .= "<tr><td colspan='4'><hr></td></tr>"; $string .= "<tr><td colspan='4' align='left'><b>Anmerkung:</b> ".$comments."</td></tr>"; $string .= "</table>"; $email_content = $name . "\n" . $adress . "\n" . $_POST['phone'] . "\n" . $email_from . "\n\n\nWunschtermin: " . $date1 . "\nAlternative: " . $date2 . "\n\n" . $training . "\n" . $content . "\n\n\nAnmerkung: " . $comments; ////// HERE WE GOO : // create email headers $headers = 'From: ' . $email_from . "\n". 'Reply-To: '.$email_from ."\n" . 'X-Mailer: PHP/' . phpversion(); $result = mail($email_to, "Terminanfrage ".$date1, $email_content, $headers); var_dump($result); echo "<H4> Ihre Anfrage wurde abgesendet und wird in Kürze bearbeitet.</h4><p />Sollten Sie Fragen oder Anregungen haben, <a href='contact.html'>schreiben Sie uns!</a> Sie erhalten in den nächsten Tagen eine Bestätigung, oder im Falle einer Absage den Grund und einen neuen Terminvorschlag.<p />Ihre Angaben im Überblick:<p />"; echo $string; echo "<div style='height:150'></div>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/252584-php-mail-returns-false/ Share on other sites More sharing options...
Pikachu2000 Posted December 6, 2011 Share Posted December 6, 2011 At the risk of asking an obvious question, do you have a mail server installed and running? Quote Link to comment https://forums.phpfreaks.com/topic/252584-php-mail-returns-false/#findComment-1294932 Share on other sites More sharing options...
pokernarr Posted December 7, 2011 Author Share Posted December 7, 2011 yes, as i said exactly the same code is working at the same server on another .php-page. I am fairly new to PHP and scripting in general (actually i only used AutoIT efficiently so far) that i don't know where to search for to get this fixed. The help file on mail() gave no information. $header and $email_to are both fine. the $subject param should be ($date1 is a string like '19.06.1999' ). $email_content used to be html-code, but i formatted it into a string just to see if something happens. Nothing happened. Quote Link to comment https://forums.phpfreaks.com/topic/252584-php-mail-returns-false/#findComment-1295148 Share on other sites More sharing options...
xyph Posted December 7, 2011 Share Posted December 7, 2011 I don't know of any documented behavior of PHP doing this. Unless there's some sort of htaccess restriction or CRAZY outside configuration, there's no way a built in function should work on one page, and not the other. I don't think it's possible to get this behavior on two files in the same directory. Quote Link to comment https://forums.phpfreaks.com/topic/252584-php-mail-returns-false/#findComment-1295152 Share on other sites More sharing options...
Pikachu2000 Posted December 7, 2011 Share Posted December 7, 2011 yes, as i said exactly the same code is working at the same server on another .php-page. You said nothing of it being on the same server. Quote Link to comment https://forums.phpfreaks.com/topic/252584-php-mail-returns-false/#findComment-1295245 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.