Hello,

does anybody have experience with function imap_mail_compose() ??

There is an example in the documentation but in my
script the "description" doesn't work. So the filename of the attachement
is not avaliable.

And why starts the $body-Array with $body[1] and not with body[0] ?

Martin

The System:
PHP Version 4.0.4pl1;
IMAP Support enabled
IMAP c-Client Version 4.1

The Script:
 ...
 // Anlagen
 $n=count($HTTP_POST_FILES["email_anlage"]["tmp_name"]);
 if ($n>1 || ($n==1 &&
file_exists($HTTP_POST_FILES["email_anlage"]["tmp_name"][0]))) {
  // multipart!!!
  $body[1]["type"]=TYPEMULTIPART;
  $body[1]["subtype"]="mixed";
  // Eingabetext
  $body[2]["type"]=TYPETEXT;
  $body[2]["subtype"]="plain";
  $body[2]["description"]=$email_betreff;
  $body[2]["contents.data"]=$email_text;
  for ($i=0;$i<$n;$i++) {
   $j=$i+3;
   $regs=array();
   if
(!ereg("(.*)/(.*)",$HTTP_POST_FILES["email_anlage"]["type"][$i],$regs)) {
    $regs[1]=TYPEAPPLICATION;
    $regs[2]="octet-stream";}
   else {
    $mime_type=array("TEXT"=>0, "MULTIPART"=>1, "MESSAGE"=>2,
"APPLICATION"=>3, "AUDIO"=>4, "IMAGE"=>5, "VIDEO"=>6, "OTHER"=>7);
    $regs[1]=strtoupper($regs[1]);
    $regs[1]=$mime_type["$regs[1]"];}
   $body[$j]["description"]=$HTTP_POST_FILES["email_anlage"]["name"][$i];
   $body[$j]["type"]=$regs[1];
   $body[$j]["subtype"]=$regs[2];
   $body[$j]["encoding"]=ENCBINARY;
   $fp=fopen($HTTP_POST_FILES["email_anlage"]["tmp_name"][$i],"r");

$body[$j]["contents.data"]=fread($fp,filesize($HTTP_POST_FILES["email_anlage
"]["tmp_name"][$i]));
   fclose($fp);}
  $email_text=imap_mail_compose($envelope,$body);}

...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to