note 25039 added to ref.mail

From: Date: Sun, 08 Sep 2002 21:12:00 +0000
Subject: note 25039 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-36365@lists.php.net to get a copy of this message
Im working on a mailing function but i cant seem to get it to work, does any one have an idea why? function sendmsg($to, $cc, $bcc, $subject, $text, $from, $file, $type, $usehtml) { if (empty($to) or empty($subject) or empty($text) or empty($from)) return false; $uid = strtoupper(md5(uniqid(time()))); $header = "From: $from\nReply-To: $from\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-Type: multipart/mixed; boundary=$uid\n"; $header .= "--$uid\n"; if ($usehtml) { $header .= "Content-type: text/html; charset=iso-8859-1\r\n"; } else { $header .= "Content-Type: text/plain\n"; $header .= "Content-Transfer-Encoding: 8bit\n\n"; } $header .= "$text\n"; $header .= "--$uid\n"; if ($file) { $content = @fread(fopen($file,"r"),filesize($file)); $content = @chunk_split(base64_encode($content)); $name = basename($file); if ($type=="") $type = "application/x-unknown-content-type"; $header .= "Content-Type: $type; name=\"$name\"\n"; $header .= "Content-Transfer-Encoding: base64\n"; $header .= "Content-Disposition: attachment; filename=\"$name\"\n\n"; $header .= "$content\n"; $header .= "--$uid--"; } if ($cc) $header .= "Cc: ".$cc."\r\n"; if ($bcc) { if (!$cc) $header .= "Cc: ".$bcc."\r\n"; else $header .= "Bcc: ".$bcc."\r\n"; } $header .= "X-Priority: 1\r\n"; $header .= "X-MSMail-Priority: High\r\n"; $header .= "X-Mailer: PHP / ".phpversion()."\r\n"; if (!@mail($to, $subject, "", $header)) return false; return true; } -- http://www.php.net/manual/en/ref.mail.php http://master.php.net/manage/user-notes.php?action=edit+25039 http://master.php.net/manage/user-notes.php?action=delete+25039 http://master.php.net/manage/user-notes.php?action=reject+25039

« previous php.notes (#36365) next »