For some reason this is not working.  I do not have enough experience
with email headers to know why.  Suffice to say it is not sending the
$message string as an attachment.  Instead it is ending up in the
standard body of the email.  And whatever ends up on the body is only a
fraction of what is stored in the $file string (containing the plain
text data to be attached).  The code that I am using is almost directly
copied from Kevin Yanks, Email Attachment tutorial at
http://www.webmasterbase.com/article/679/82
 
I can only assume I am missing a critical step.  Any help you can give
will be greatly appreciated.
 
--
Kevin Stone
[EMAIL PROTECTED]
 
//----------------------------------------------------------------------
-----
            // Generate a boundary string
            $semi_rand = md5(time());
            $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
            
            // Add the headers for a file attachment
            $headers .=
            "\nMIME-Version: 1.0\n" .
            "Content-Type: multipart/mixed;\n" .
            "boundary=\"{$mime_boundary}\"";
            
            // Add a multipart boundary above the plain message
            $message = 
            "This is a multi-part message in MIME format.\n\n" .
            "--{$mime_boundary}\n" . 
            "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . 
            "Content-Transfer-Encoding: 7bit\n\n" . 
            $file . 
            "\n\n";
            
            $to = '[EMAIL PROTECTED]';
            $subject = 'test';
            
            // Send the message
            $result = @mail($to, $subject, $message, $headers);
            if ($result)
            {
                        echo "<p><font color=green>Mail sent! Yay
PHP!</font></p>";
            }
            else
            {
                        echo "<p><font color=red>Mail could not be sent.
Sorry!</font></p>";
            }
//----------------------------------------------------------------------
---------------


Reply via email to