Re: HELP!! Mail and attachments

From: Date: Fri, 27 Apr 2001 14:16:35 +0000
Subject: Re: HELP!! Mail and attachments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-50685@lists.php.net to get a copy of this message
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" <trehm@fitnessquest.com> To: <php-general@lists.php.net> 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 <mary@u.college.edu>" . ", "; #//note the comma > #$recipient .= "Kelly <kelly@u.college.edu>" . ", "; > #$recipient .= "ronabop@php.net"; > $recipient = "trehm@comdotnetworking.com"; > > #/* 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 <birthday@php.net>\n"; > $headers .= "X-Sender: <birthday@php.net>\n"; > $headers .= "X-Mailer: PHP\n"; // mailer > $headers .= "X-Priority: 1\n"; // Urgent message! > $headers .= "Return-Path: <birthday@php.net>\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:birthdayarchive@php.net\n"; // CC to > #$headers .= "bcc:birthdaycheck@php.net, birthdaygifts@php.net\n"; // BCCs > to > #$headers .= "cc:trehm@fitnessquest.com\n"; // CC to > #$headers .= "bcc:trehm@comdotnetworking.com, > telathos@comdotnetworking.com\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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#50685) next »