I would recommend that you send a link instead of the actual doc file.

Chris Anderson   aka "Null"
--------------------------------------------
PHP Developer / Nulltech
PHP-GTK Tester / gtk.php.net
STA Administrator / www.stronger.org
DOD Co-Owner / www.dayofdefeat.com

----- Original Message -----
From: "Tym Rehm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 27, 2001 9:46 AM
Subject: [PHP] HELP!! Mail and attachments


> I have been trying to get this to work for days and I'm confused. I want
to
> attach a Word document to an email. I found this code on php.net and I'm
> trying to modify it to work. I get the email sent, the attached Word
> document is filled with junk and not the document I'm trying to send.
>
> Here is the code and sorry for the large email.
>
> <?php
> $border="--==================_856811060==_";
> #/* recipients */
> #$recipient .= "Mary <[EMAIL PROTECTED]>" . ", "; #//note the comma
> #$recipient .= "Kelly <[EMAIL PROTECTED]>" . ", ";
> #$recipient .= "[EMAIL PROTECTED]";
> $recipient = "[EMAIL PROTECTED]";
>
> #/* subject */
> $subject = "Birthday Reminders for August";
>
> #/* message */
> $message .= "$border\n";
> $message .= "Content-Type: text/plain; charset=us-ascii;format=flowed\n";
> $message .= "The following email includes a formatted ASCII table\n";
> $message .= "Day \t\tMonth \t\tYear\n";
> $message .= "3rd \t\tAug \t\t1970\n";
> $message .= "17rd\t\tAug \t\t1973\n";
> $message .= "$border\n";
> #$message .= "Content-Type: application/msword; name=\"/mail/Ftp\ User\
> Info.doc\"\n";
> #$message .= "Content-Transfer-Encoding: base64\n";
> #$message .= "Content-Disposition: attachment; filename=\"/mail/Ftp\ User\
> Info.doc\"\n";
> #$message .="$border\n";
>
> #/* you can add a stock signature */
> $message .= "--\r\n"; //Signature delimiter
> $message .= "Birthday reminder copylefted by public domain";
>
> #/* additional header pieces for errors, From cc's, bcc's, etc */
>
> $headers .= "From: Birthday Reminder <[EMAIL PROTECTED]>\n";
> $headers .= "X-Sender: <[EMAIL PROTECTED]>\n";
> $headers .= "X-Mailer: PHP\n"; // mailer
> $headers .= "X-Priority: 1\n"; // Urgent message!
> $headers .= "Return-Path: <[EMAIL PROTECTED]>\n";  // Return path for
errors
> # I added this code
> $headers .= "Mime-Version: 1.0\n";
> $headers .= "Content-Type: multipart/mixed; boundary=\"$border\"\n";
> #$headers .= "Content-Type: text/plain; charset=us-ascii;format=flowed\n";
> $headers .= "Content-Type: application/msword; name=\"Ftp\ User\
> Info.doc\"\n";
> $headers .= "Content-Transfer-Encoding: base64\n";
> $headers .= "Content-Disposition: attachment; filename=\"Ftp\ User\
> Info.doc\"\n";
>
> #/* If you want to send html mail, uncomment the following line */
> #$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
>
> #$headers .= "cc:[EMAIL PROTECTED]\n"; // CC to
> #$headers .= "bcc:[EMAIL PROTECTED], [EMAIL PROTECTED]\n"; // BCCs
> to
> #$headers .= "cc:[EMAIL PROTECTED]\n"; // CC to
> #$headers .= "bcc:[EMAIL PROTECTED],
> [EMAIL PROTECTED]\n"; // BCCs to
>
> #/* and now mail it */
> mail($recipient, $subject, $message, $headers);
> print "<html><head><title>Mail</title></head>\n";
> print"<body>\n";
> print "<p>Mail Sent?\n";
> print"</body></html>\n";
> ?>
>
> Thanks!!!!!!!!
>
>
>
> --
> 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]
>


-- 
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