note 39486 deleted from ref.mail by kennyt

From: Date: Sun, 18 Jul 2004 17:37:01 +0000
Subject: note 39486 deleted from ref.mail by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73527@lists.php.net to get a copy of this message
Note Submitter: nico@cpp-club.net ---- Hello. I have tested your xmail-function, and your function has errors. With this function you can send attachments now... and you have mor fields, like copycarbon and blindcopycarbon. Fields: $email_address -> there the mail goes to. $email_cc -> there goes a copy to. $email_bcc -> there goes a copy to, too, but you can not see this emailaddress. $email_from -> there the email comes from. $subject -> Subject field. $msg -> This is the message. $attach_filepath -> has to be an array of paths for the attachments. $want_attach -> If you want to send an attachment, set this to true, if not, then to false... you must not have this variable, but i set it. you may delete this field... ------------------------------------ function xmail ($email_address, $email_cc, $email_bcc, $email_from, $subject, $msg, $attach_filepath, $want_attach) { $b = 0; $mail_attached = ""; $boundary = "000XMAIL000"; if (count($attach_filepath)>0 && $want_attach) { for ($a=0;$a<count($attach_filepath);$a++) { if ($fp=fopen($attach_filepath[$a],"rb")) { $file_name=basename($attach_filepath[$a]); $content[$b]=fread($fp,filesize($attach_filepath[$a])); $mail_attached.="--".$boundary."\n" ."Content-Type: image/jpeg; name=\"$file_name\"\n" ."Content-Transfer-Encoding: base64\n" ."Content-Disposition: inline; filename=\"$file_name\"\n\n" .chunk_split(base64_encode($content[$b]))."\n"; $b++; fclose($fp); } else { echo "Anhang konnte nicht gesendet werden."; } } $mail_attached .= "--".$boundary."\n"; $add_header ="MIME-Version: 1.0\n" ."Content-Type: multipart/mixed; boundary=\"$boundary\"; Message-ID: <".md5($email_from)."@domain.net>"; $mail_content="--".$boundary."\n" ."Content-Type: text/plain; charset=\"iso-8859-1\"\n" ."Content-Transfer-Encoding: 8bit\n\n" .$msg."\n\n".$mail_attached; return mail ($email_address, $subject, $mail_content, "From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc ."\nErrors-To: ".$email_from."\n".$add_header); } else { return mail ($email_address, $subject, $msg, "From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc ."\nErrors-To: ".$email_from); } }

« previous php.notes (#73527) next »