Re: mail() returns false but e-mail is sent ?
| From: | Adam Zey | Date: | Mon, 26 Jun 2006 15:32:46 +0000 |
| Subject: | Re: mail() returns false but e-mail is sent ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238638@lists.php.net to get a copy of this message | ||
Leonidas Safran wrote:
Hello,And what code is checking the return value of mail()? Trust me, we've all made stupid mistakes, they're nasty little buggers that can sneak in and ruin anyone's day; best to include it since it might be relevant. Regards, Adam.Show us the full context of the code. The example you give us will work fine but that doesn't tell us what's really going on in your code.Here is the function I use to allow french special characters in the subject line (copied from german university tutorial http://www-cgi.uni-regensburg.de/~mim09509/PHP/list.phtml//www-cgi/home/mim09509/public_html/PHP/mail-quote.phtml?datei=%2Fwww-cgi%2Fhome%2Fmim09509%2Fpublic_html%2FPHP%2Fmail-quote.phtml%2Crfc822-syntax.txt): function quote_printable($text, $max=75){ /* $text ist ein String (mit neue Zeilen drin), $max ist die max. Zielenlaenge Ergebnis ist auch ein String, der nach rfc1521 als Content-Transfer-Encoding: quoted-printable verschluesselt ist.*/ $t = explode("\n", ($text=str_replace("\r", "", $text))); for ($i = 0; $i < sizeof($t); $i++){ $t1 = ""; for ($j = 0; $j < strlen($t[$i]); $j++){ $c = ord($t[$i][$j]); if ( $c < 0x20 || $c > 0x7e || $c == ord("="))$t1 .= sprintf("=%02X", $c);else $t1 .= chr($c); } while (strlen($t1) > $max+ 1){ $tt[] = substr($t1, 0, $max)."="; $t1 = substr($t1, $max); } $tt[] = $t1; } return join("\r\n", $tt); } function qp_header($text){ $quote = quote_printable($text, 255); if ($quote != $text) $quote = str_replace(" ", "_","=?ISO-8859-1?Q?" . $quote . "?="); return $quote; } So, before I enter: $sent = mail($destination, $subject, $content, $headers); I have: $subject = qp_header($subject); That's all... As said before, the e-mail is sent, but the mail() function returns false ! Thank you for your help LS