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