note 39486 added to ref.mail
| From: | nico at cpp-club dot net | Date: | Fri, 30 Jan 2004 08:33:29 +0000 |
| Subject: | note 39486 added to ref.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64407@lists.php.net to get a copy of this message | ||
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);
}
}
----
Manual Page -- http://www.php.net/manual/en/ref.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39486
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39486&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39486&report=yes
Search -- http://master.php.net/manage/user-notes.php