note 13545 deleted from function.mail by jimw

From: Date: Wed, 31 Oct 2001 23:25:17 +0000
Subject: note 13545 deleted from function.mail by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19920@lists.php.net to get a copy of this message
Just a little bit of useful code that allows you to send html mail, the arguments being in my usual strange form (sorry) but they are in order (from,to,subject,htmlbody,textbody) Where textbody is optional an if omitted will be replaced with a plain text version of the htmlbody line function htmlmail($f,$t,$s,$h,$b = "UNSPECIFIED") { if ($b == "UNSPECIFIED") { $b = strip_tags($h); } $headers = "From: $f\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $q = uniqid("WblQ"); $headers .= "Content-Type: multipart/alternative" . "; boundary = $q\r\n\r\n"; $headers .= "This is a MIME encoded message.\r\n\r\n"; $headers .= "--$q\r\n" . "Content-Type: text/plain; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode($b)); $headers .= "--$q\r\n" . "Content-Type: text/html; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode($h)); mail($t, $s, "", $headers); }

« previous php.notes (#19920) next »