I had experience this similar problem with the attachment, as it turned out
that not all email software work out the same way, especially with
MS-Exchange which need an extra "\r" or "\n" for it to work.

For the attachment issue you have.  I don't know what Content-Type you're
using because it showed $usehtml.  The problem most likely lies with the
Content-Type that aren't specified correctly.  For text type, I use
"Content-Type: text/plain; charset=\"iso-8859-1\"\n".  If you use html type
then it would be "Content-Type: text/html; <<blah blah>>\n";  I don't know
if you need to specify the charset type for that type.

FletchSOD


"Shyxu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm using Mail.php which is located in /usr/local/lib/php
> I made a mail program by php.
> Which is attaching a file.
>
> But I guess there's problem in MIME syntax.
> I don't know what is wrong...
>
> What's the problem?
>
>
> ****** Below this line is php codes. ******
> include "Mail.php";
>
> // defines header
> $headers['Subject'] = $subject;
> $headers['From'] = $sender." <".$senderemail.">";
> $headers['Content-Type'] = "multipart/related";
> $headers['Return-Path'] = "<".$senderemail.">";
> $headers['Errors-To'] = "<".$senderemail.">";
>
> // message
> $message .= "------=MIME_BOUNDRY_message_parts\n";
> $message .= "Content-Type: $usehtml; \n";
> $message .= "Content-Transfer-Encoding: quoted-printable\n";
> $message .= "\n$ment\n";
> $message .= "------=MIME_BOUNDRY_message_parts--\n\n";
>
> // Attachments
>
> if ( $_FILES['attach']['error'] === 0 ) {
>         //Upload and Attach
>         $tmpName = $_FILES['attach']['tmp_name'];
>         $fileName = $_FILES['attach']['name'];
>         $filePath = "./attach/";
>         $fileSize = $_FILES['attach']['size'];
>
>         $AttmFile = $filePath.$fileName;
>
>         move_uploaded_file( $tmpName, $AttmFile ) or die( "upload
failed" );
>
>         // now we add attachments
>         $message .= "\n\n------=MIME_BOUNDRY_main_message\n";
>         $message .= "Content-Type: ".$_FILES['attach']['type'].";
> name=\"".$fileName."\";\n";
>         $message .= "Content-Disposition: attachment;
> filename=\"".$fileName."\";\n\n";
>         $message .= "Content-Transfer-Encoding: base64;\n";
>         $message .= "\n";
>
>         //file goes here
>         $fd=fopen ($AttmFile, "r");
>         $FileContent=fread($fd,filesize($AttmFile));
>         fclose ($fd);
>         $FileContent=chunk_split(base64_encode($FileContent));
>         $message.=$FileContent;
>         $message .= "\n------=MIME_BOUNDRY_main_message\n";
> }
>
>
> // SMTP Connection
> $params['host'] = $smtphost;
> $params['auth'] = true;
> $params["username"] = $smtpuser;
> $params["password"] = $smtppwd;
> $mailer = &Mail::factory('smtp', $params);
>
> $email = "[EMAIL PROTECTED]"; # use my email address for test.
>
>
> // send and check status
> $status =$mailer->send($email, $headers, $message);
> if (PEAR::isError($status)) {
>         echo "fail";
>         $fail++;
> } else {
>         echo "success";
>         $success++;
> }
>
>
>
> ****** Below this line is what I sent. ******
>
> Return-Path: <[EMAIL PROTECTED]>
> Delivered-To: [EMAIL PROTECTED]
> Subject: <C0><FC><C3><BC><B8><DE><C0><CF> <C5><D7><BD><BA><B6><D1>
> From: <C1><F8><C5><C2> <[EMAIL PROTECTED]>
> Content-Type: multipart/related
> Errors-To: <[EMAIL PROTECTED]>
>
> ------=MIME_BOUNDRY_message_parts
> Content-Type: text/html;
> Content-Transfer-Encoding: quoted-printable
>
> 5G4B1d0!..
> <b>EW=:6Q</b>
>
> EW=:F.6s4O1q...
> :83;Av6u8;@L>_!!
> ------=MIME_BOUNDRY_message_parts--
>
>
>
> ------=MIME_BOUNDRY_main_message
> Content-Type: application/octet-stream; name="README";
> Content-Disposition: attachment; filename="README";
>
> Content-Transfer-Encoding: base64;
>
>
xu3B/cC6IEdMSUJDIDEuMDkgQmV0YSC59sD8IL+1ua7Gx8C7ILHiwdjAuLfOIMfPv7S9wLTPtNku
>
DQrC98DMwaHAuiDBtrHdu9PAzLHiILanua6/oSCwxcDHILCwtNmw7SC6uL3DuOkgtcu0z7TZLg0K
>
wM+53SDDpcDaIMWpseLAziBCNbfOIMbtwf3AzCC1x77uIMDWvu68rQ0Kt7nAzMD6IMfBuLDFzbfO
>
IMPit8LH2LytILmtwLi46SCx17Trt84gw6XAzCC1y7TPtNkuDQq/wMDaILz2waTAuiC0q7+hILbn
>
tMKwzSC47rCzuLggx9Egu/PFwrbzIMDawdYgurjAzMH2uLgNCrHXt7iw1CDFqyC5rsGmtMIgvvjA
>
u7DNILCwsO0NCsfUvPYgv+S+4CC6zrrQKMDMsMcgv7W5rsbHwMcgx9i057rOutDAuyDAzrzix9i8
>
rSC1obrZwMy9w7HmKSwNCsL8sO3AxyDCyrz2IMH2waSw+iDH1Lz2LCC6r7z2IElOREVYILXuwMwg
>
vvi9wLTPtNkuDQqx17DNtem4uCC52bfOIMDitMK02bjpIL/Puq7H2MH2sNrB9ri4DQqx17eyIL3D
>
sKPAzCC++LDtILbHILPKuasgwfbDxLytILj4x8+w2rG6v+QuDQqx17PJILq4vLy/5C4uLi4uLS07
>
DQrD4rfCx8+9xyC2qSBnbGliY3RpdC5od3AsIGdsaWJjaWR4Lmh3cCwgZ2xpYmMuaHdwuKYNCrz4
>
vK2067fOIMPit8LHz73DuOkgtcu0z7TZLg0Kvue46SDAzrziuKYgx8+w7SC9zcC4vcO46SAowM+5
>
3cD7wM4gsOa/7CkNCsOzwL2/oyDAzrzivcO/obytIMKmvPbCysC7ILjVwPogwM684sfPvcOw7Q0K
>
tNnAvb+hIMimvPbCysC7IMDOvOLHz73DuOkgwve3yrTrt84gs6q/zSDA1sC7sMy0z7TZLg0Ksde3
>
syC1tb/yILXHvMyx5iC52bb4tM+02S4NCg0KICAgICAgICAgICAgICAgICAgICBSQUdOQVJvS0Bo
>
aXRlbC5rb2wuY28ua3INCiAgICAgICAgICAgICAgICAgICAgwfe+vr+hvK0guvO11bTrtMIgvu62
> ssDMDQo=
>
> ------=MIME_BOUNDRY_main_message--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to