I believe you will need to stuff the body into the mime-headers like another
attachment and have the body be empty...  Even that *may* not work...

Another option is to bypass the mail() function entirely and just fsockopen
to port 25 and fread/fwrite the right stuff to talk to SMTP.  It ain't
rocket science -- I've even managed to do it for regular mail in higher
volume than mail() can handle.

Disclaimer:  I'd find it easier to snag somebody else's attachment class,
and I hate classes in PHP...  You could just look at their source and see
how they do it.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: M <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 20, 2001 7:12 PM
Subject: About old msg on attachements using PHP mail function


> Hello, regarding old email from [EMAIL PROTECTED] about mail
> attachements
>
> From: py" <[EMAIL PROTECTED]>  21/05/01 08:25
> Subject: Re: [PHP] sending attachements with mail
>     To: "Tolga \"thorr\" Orhon" <[EMAIL PROTECTED]>
>     CC: <[EMAIL PROTECTED]>
>
> Here is a nice class that handles e-mail attachment.
> Works fine for me.
>
> ....
>
> function write_mimeheaders($filename, $mime_filename) {
>  if ($mime_filename) $filename = $mime_filename;
>  $out = "MIME-version: 1.0\n";
>  $out = $out . "Content-type: multipart/mixed; ";
>  $out = $out . "boundary=\"$this->mime_boundary\"\n";
>  $out = $out . "Content-transfer-encoding: 7BIT\n";
>  $out = $out . "X-attachments: $filename;\n\n";
>  return $out;
> }
>
> function write_smtpheaders($addr_from) {
>  $out = "From: $addr_from\n";
>  $out = $out . "Reply-To: $addr_from\n";
>  $out = $out . "X-Mailer: PHP3\n";
>  $out = $out . "X-Sender: $addr_from\n";
>  return $out;
> }
>
> .......
>
> I am trying to attach single text file to mail, then don't want to
> implement new class for this task.
> I imagine to send MIME messages, it would be enough build appropriate
> headers, in same way PY wrote these functions above, then send these
> headers into PHP mail function.
>
> PHP mail function has parameters ($TO,$SUBJECT,$BODY,$HEADERS) , then I
> built MIME headers into $HEADERS parameter. Message arrives ok to me,
> headers are right placed into message headers, but no attachements
> appears for me (and no body also!)
> My doubt is: when sending MIME parts, should $BODY be empty (and actual
> body sent like MIME part), or rather should I mount all my headers into
> $BODY and let $HEADERS empty?
>
> What I made is:
>
> $mime = 'From: [EMAIL PROTECTED]\n';
> $mime = $mime . 'MIME-version: 1.0\n';
> $mime = $mime . 'Content-type: multipart/mixed\n';
> $mime = $mime . 'Boundary="1234567890"\n';
> $mime = $mime . '--1234567890';
> $mime = $mime . 'Content-type: text/plain; name="myfile.txt";';
> $mime = $mime . 'this is my text file to be attached, blha blha
> blha...';
>
> mail([EMAIL PROTECTED],"mysubject","mybody",$mime)
>
> mail arrives ok, but no body and no attachement into.
>
> Thanks in advance.
>
> Miguel
>
>


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