> We hired a developer about a year ago to develop a
> web based email system for us in php. The developer
> is no longer around, so I am having to pick up
> the development on the project...When clicking
> on the attachment link of an email in Internet
> Explorer 5.5 in Windows 98, I get the save as dialog
> and when I select ok, it tries to save the html
> page. If I right click and do save target as, it
> gets the correct file. This all works correctly in
> IE 5.0 and Netscape 4.76, and what's weird is that
> it even works as expected in IE 5.5 running on Win2k.
> Can anyone offer any suggestions? I'll be glad to send
> any code snipplets, or info if anyone can clue me in...
>
> Jack Davis
> Network Admin
> Bootheel Internet Services

I built this a few months ago and it seems to work for most things I have
tried.  It is supposed to handle text email clients and MIME clients as
well.

The site variable is a class variable that contains all sorts of stuff.
  var $mail_from = "[EMAIL PROTECTED]";
  var $mail_reply_to = "[EMAIL PROTECTED]";


  function
mail_it($subject,$mail_message,$mail_to="[EMAIL PROTECTED]",$mail_
attachment="",$from="",$reply_to="") {
    global $site;
    if ($from) { $mail_from="From:$from"; } else
 $mail_from="From:".$site->mail_from; }
    if ($reply_to) { $mail_reply_to="Reply-To:$reply_to"; } else
 $mail_reply_to="Reply-To:".$site->mail_reply_to; }

    $rand=md5(rand());
    $boundary="----=_NextPart_000_$rand";
    $boundary2="----=_NextPart_001_$rand";
    $mail_headers = "$mail_from\n$mail_reply_to\n";
    $mail_headers .= "Content-Type: multipart/mixed;\n
boundary=\"$boundary\"";
    $mail_headers .= "\nX-Priority: 3 (Normal)\nX-Mailer: Walters And
Associates WCDS, Build 1.01\nImportance: Normal";
    $mail_body = "";
    $mail_body .= "  This message is in MIME format.  The first part
should";
    $mail_body .= "be readable text,\n  while the remaining parts are";
    $mail_body .= "likely unreadable without MIME-aware tools.\n  Send
mail";
    $mail_body .= "to [EMAIL PROTECTED] for more information.\n";
    $mail_body .= "\n";
    $mail_body .= "--".$boundary;
    $mail_body .= "\n";
    $mail_body .= "Content-Type: multipart/alternative;\n
boundary=\"$boundary2\"\n";
    $mail_body .= "\n";
    $mail_body .= "\n";
    $mail_body .= "--".$boundary2."\n";
    $mail_body .= "Content-Type: text/plain;\n
charset=\"iso-8859-1\"\n";
    $mail_body .= "Content-Transfer-Encoding: 7bit\n";
    $mail_body .= "\n";
    $mail_body .= strip_tags($mail_message)."\n";
    $mail_body .= "\n";
    $mail_body .= "\n";
    $mail_body .= "--".$boundary2."\n";
    $mail_body .= "Content-Type: text/html;\n
charset=\"iso-8859-1\"\n";
    $mail_body .= "Content-Transfer-Encoding: quoted-printable\n";
    $mail_body .= "\n";
    $mail_body .= "$mail_message\n";
    $mail_body .= "\n";
    $mail_body .= "--".$boundary2."--\n";
    $mail_body .= "\n";

    if ($mail_attachment<>"") {
      $content = get_page($mail_attachment);
      if ($content) {
        $mail_body .= "--".$boundary."\n";
        $mail_body .= "Content-Type: application/octet-stream\n";
        $mail_body .= "        name=\"".basename($mail_attachment)."\"\n";
        $mail_body .= "Content-Transfer-Encoding: base64\n";
        $mail_body .= "Content-Description: \"Mail Attachment\"\n";
        $mail_body .= "Content-Disposition: attachment;\n";
        $mail_body .= "
filename=\"".basename($mail_attachment)."\"\n";
        $mail_body .= "\n";
        $mail_body .= base64_encode($content)."\n\n";
      }
    }
    $mail_body .= "--".$boundary."--\n";

    if (mail($mail_to,"$subject",$mail_body,$mail_headers)) {
      logger(1,"Mail Success","$subject To $mail_to",$mail_message);
      return TRUE;
    } else {
      logger(9,"Mail Failure",$mail_to,$mail_body);
      return FALSE;
    }
  }




Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


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