Email attachment with word documen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrbadboy
    New Member
    • Jul 2007
    • 21

    Email attachment with word documen

    Hi,

    How to attach word document file (*.doc) in a mail ? I tried to attach it with the blow codes...

    $headers .= "Content-Type: application/msword; charset=iso-8859-1\n";
    $headers .= "Content-Transfer-Encoding: ". "base64\n";
    $headers .= "Content-Disposition: attachment\n\n" ;
    $filedata = implode(file('m ailattach.doc') , '');
    $headers .= chunk_split(bas e64_encode($fil edata));
    mail($to, $subject, $body, $headers);

    I can get attachment file from this code. But i can get only *.txt format files only not *.doc. Even the file also correpted when i download from mail. I couldn't read the content from that file. How to solve this problem ?

    Thanks.
  • Weisbartb
    New Member
    • Aug 2007
    • 36

    #2
    Originally posted by mrbadboy
    Hi,

    How to attach word document file (*.doc) in a mail ? I tried to attach it with the blow codes...

    $headers .= "Content-Type: application/msword; charset=iso-8859-1\n";
    $headers .= "Content-Transfer-Encoding: ". "base64\n";
    $headers .= "Content-Disposition: attachment\n\n" ;
    $filedata = implode(file('m ailattach.doc') , '');
    $headers .= chunk_split(bas e64_encode($fil edata));
    mail($to, $subject, $body, $headers);

    I can get attachment file from this code. But i can get only *.txt format files only not *.doc. Even the file also correpted when i download from mail. I couldn't read the content from that file. How to solve this problem ?

    Thanks.
    Add
    [php] $headers .="name=\"docna me.doc\"\n";[/php]

    After the 3rd $header.

    Comment

    Working...