RE: [PHP-WIN] attach xml file to e-mail
| From: | Oliver John Tibi | Date: | Tue, 27 Jul 2004 16:13:09 +0000 |
| Subject: | RE: [PHP-WIN] attach xml file to e-mail | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-24267@lists.php.net to get a copy of this message | ||
hi!
the encoding-type header do not matter unless you really endcode the xml attachment. try to encode the xml file by using PHP's base64_encode() function.
HTH. Peace!
Running 'ojtibi' on '127.0.0.1' (BATCH_OPTIMISTIC mode).
"Live free() or die()."
From: <emrahsen51@yahoo.com> To: php-windows@lists.php.net Subject: [PHP-WIN] attach xml file to e-mail Date: Tue, 27 Jul 2004 07:20:03 -0700 (PDT) Hi, i want to make a program that reads data from database and create a xml file. Then mail this file to someone else... there is no problem in creating file or mailing. but when i open the attachment in e-mail, some characters in xml tags disappear. so recipient can't parse xml file in attachment. for example in orijinal xml file <member> <name>emrah</name> <surname>sener</surname> </member> in the attachment <member> <name>emrah</name> <surname>sener</surame>(!!!) </member> is this problem about transfer encoding? i try 7bit, 8bit, base64 ... but nothing happens... $mime_boundary = "<<<--==+X[".md5(time())."]"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed;\r\n"; $headers .= " boundary=\"".$mime_boundary."\""; $message .= "This is a multi-part message in MIME format.\r\n"; $message .= "\r\n"; $message .= "--".$mime_boundary."\r\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; $message .= "Content-Transfer-Encoding: 8bit\r\n"; $message .= "\r\n"; $message .= "Transfer List: \r\n"; $message .= "--".$mime_boundary."\r\n"; $message .= "Content-Type: text/xml; charset=\"iso-8859-1\"\r\n"; $message .= " name=".basename("transfer.xml")."\r\n"; $message .= "Content-Transfer-Encoding: 8bit\r\n"; $message .= "Content-Disposition: attachment;\r\n"; $message .= " filename=\"transfer.xml\"\r\n"; $message .= "\r\n"; $fp = fopen("transfer.xml","rb"); $message .= fread($fp, filesize("transfer.xml")); $message .= "\r\n"; $message .= "--".$mime_boundary."\r\n"; $go = mail("emrahsen51@yahoo.com","XML Transfer", $message, $headers); thanks... __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail