Greetings all. (hope this isn't a second post, first try seemed to fail)

In an effort to understand more about mime mail, I'm writing a
little function to send a multipart/alternative encoded mime mail from a
browser interface. I know you guys have answered these types of questions
many times, but I've googled and research til I'm blue. I'm still somewhat
new to php so I apologize. I'm on a shared hosting environment running
Apache 1.3.29 (Unix), magic_quotes_gpc = on, path to sendmail =
/usr/sbin/sendmail -t -i, smtp is localhost on port 25 (and I don't know
much about Unix permissions). My client platform is Mac, my email client is
Outlook Express (might as well be testing to the lowest common denominator).
I've found lots of php classes on mime mail but have not tried them because
I want to understand the code.

I can use this code to send plain text email or html email just fine, but
not multipart/alternative or mixed. Here's the relevant code. Can someone
point out the error of my ways?

browser interface: 5 fields (3 input of type=text, 2 input of type=textarea)
names:
    $from
    $to
    $subject
    $text_msg
    $html_msg
    
On submit, I trim all and stripslashes on the textarea inputs (interesting
that magic quotes seems to add slashes to textarea inputs automatically),
then set my email headers:

$headers ="From: {$from}\n";
$headers .="Reply-To: {$from}\n";
$headers .="Return-Path: {$from}\n";
$headers .="Subject: {$subject}\n";
$headers .="X-Sender: {$from}\n";
$headers .="X-Mailer: PHP\n";
$headers .="X-MSMail-Priority: High\n";
$headers .="MIME-Version: 1.0\n";
$headers .="Content-Type: multipart/alternative;
boundary=\"--i0o9u8h7g65v\"";
$message ="--i0o9u8h7g65v\n";
$message .="Content-Type: text/plain; charset=iso-8859-1\n";
$message .="Content-Transfer-Encoding: 7bit\n";
$message .="Content-Disposition: inline\n";
$message .=$text_msg."\n";//plain text message here
$message .="--i0o9u8h7g65v\n";
$message .="Content-Type: text/html; charset=iso-8859-1\n";
$message .="Content-Transfer-Encoding: 7bit\n";
$message .="Content-Disposition: inline\n";
$message .=$html_msg."\n";//html message here
$message .="--i0o9u8h7g65v";

mail($to,$subject,$message,$headers);

The email is sent successfully, but with no message in the message body.
Looking at the message source I see that all of the headers are set and I
see the boundaries and I see both versions of the messages as one would
expect. It all looks correct, even as compared to other mime encoded email I
receive and read just fine. I've tried many variations on these variables.
FYI, if I change the $header = "Content-Type: multipart/alternative; ....";
to $message = "Content-Type: ..."; then I see the raw code in the message
body, but of course that does no good. Same results when message is viewed
in a browser based hotmail or yahoo account.

I simply do not understand what I don't understand, so I don't know how to
ask my question. Is this a coding problem, sendmail, permissions, a server
issue???

Thanks for your help.


-- 
Bill
--

-- 
Bill
--

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

Reply via email to