Date: 09/30/98
- Next message: Brian Schaffner: "RE: [PHP3] Setcookie problem"
- Previous message: Rich Clingman: "Re: [PHP3] A shl()/shr() function?"
- In reply to: Rich Clingman: "[PHP3] A shl()/shr() function?"
- Next in thread: Daniel Lashua: "Re: [PHP3] Sending mail attachments"
- Reply: Daniel Lashua: "Re: [PHP3] Sending mail attachments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ok, i wasn't going to announce this yet because I havent fully tested it
all yet, and it's compilicated code so it's hard ot test.
but since i see a lot of postings go by, i decided to announce it for
BETA testers, to help let me know if there are still any bugs.
The IMAP module has a new function in the CVS repository.
Theres imap_mail_compose.
This takes in two parameters, an associative array that contains elements for the
mail header, and an array of associative arrays that continas body parts.
Heres an example of how to use it:
it can send a multipart message! auto-encoding of
body types..etc..
(note, only one levle of attachments is allowed though)
<?
$envelope["from"]="musone <email protected>";
$envelope["to"]="musone <email protected>";
$envelope["cc"]="musone <email protected>";
$part1["type"]=TYPEMULTIPART;
$part1["subtype"]="mixed";
$filename="/tmp/file.to.send.exe";
$fp=fopen($filename,"r");
$contents=fread($fp,filesize($filename));
fclose($fp);
$part2["type"]=TYPEAPPLICATION;
$part2["encoding"]=ENCBINARY;
$part2["subtype"]="octet-stream";
$part2["description"]=basename($filename);
$part2["contents.data"]=$contents;
$part3["type"]=TYPETEXT;
$part3["subtype"]="plain";
$part3["description"]="description3";
$part3["contents.data"]="contents.data3\n\n\n\t";
$body[1]=$part1;
$body[2]=$part2;
$body[3]=$part3;
echo nl2br(imap_mail_compose($envelope,$body));
?>
The envelope array can have the following fields:
remail
return_path
date
from
reply_to
to
cc
bcc
message_id
Each body array can have the following fields:
type
encoding
subtype
id
contents.data
lines
bytes
md5
type is one of the following constants:
TYPETEXT
TYPEMULTIPART
TYPEMESSAGE
TYPEAPPLICATION
TYPEAUDIO
TYPEIMAGE
TYPEVIDEO
TYPEOTHER
encoding is one of:
ENC7BIT
ENC8BIT
ENCBINRY
ENCBASE64
ENCQUOTEDPRINTABLE
ENCOTHER
This function returns a string containing the entire final mail message,complete
with headers,body type,encodings,boundaries..etc..
This will also AUTOMATICALLY encode your binary data into the specified encoding
(usually base64)
The one thing this cannot do is have multipley attached parts
(i.e. a multipart/mixed containing a multipart/mixed ..etc..)
it can only do one "level" of attachments.
Also if you are going to send multiple attachements, the first body part has
to be a multipart/mixed. (maybe in the future i'll add an auto-detection)
Go play with it if you are interested. again, this is only a BETA
release because it seems as though there are lots of people
interested, and i dont have a lot of time right now.
Let me know if anything needs ot be fixed.
Thanks,
Mark
>
> I'm looking at encoding binary files for attachment; however, I need a shift
> function.
> PHP2 has shl()/shr() (shift left/right), but PHP3 does not. I looked
> through all of the PHP3 docs & source and find no equivalent function.
> Anyone know of one or a work-around?
>
> Rich Clingman
> inlan <email protected>
>
>
>
> --
> PHP 3 Mailing List http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest list: php3-digest-subscribe <email protected>
> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
>
>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
- Next message: Brian Schaffner: "RE: [PHP3] Setcookie problem"
- Previous message: Rich Clingman: "Re: [PHP3] A shl()/shr() function?"
- In reply to: Rich Clingman: "[PHP3] A shl()/shr() function?"
- Next in thread: Daniel Lashua: "Re: [PHP3] Sending mail attachments"
- Reply: Daniel Lashua: "Re: [PHP3] Sending mail attachments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

