Forum OpenACS Development: HTML email not working with rollout support (help requested)

I'm having some difficult to track down issues with getting rollout support to work with MIME/HTML email. I need rollout support so that I don't send out a bunch of extra email while debugging work I'm doing on project-manager.

The problem is that HTML email sent without rollout support on work fine (links work right, everything looks great).

HTML email sent with rollout support on, however, doesn't even show up on my email client (Mail.app). Viewing the source, they look pretty similar, however.

-------------------------------------------------------

Message sent using the following command in Developer Support with rollout support on (this was filter, with the address mailto:jader@bread.com allowed):

pm::util::email -to_addr mailto:jader@bread.com \
  -from_addr mailto:jade-test@rubick.com \
  -subject "test" -body "<b>bold</b> <a href=\"http://www.rubick.com\">hey there</a>" \
  -mime_type "text/html"

This doesn't look right in my email client:
===========================================
Return-Path: <mailto:jade-test@rubick.com>
Delivered-To: mailto:jade@rubick.com
Received: (qmail 3616 invoked from network); 10 Sep 2004 23:34:10 -0000
Received: from mail.bread.com (HELO bread.com) (64.122.45.238)
  by 0 with SMTP; 10 Sep 2004 23:34:10 -0000
Received: (qmail 26835 invoked by uid 1030); 10 Sep 2004 16:05:50 -0700
Delivered-To: mailto:jader@bread.com
Received: (qmail 26833 invoked from network); 10 Sep 2004 16:05:50 -0700
Received: from unknown (HELO dev.bread.com) (192.168.1.14)
    by maildeb (qmail 1.03 + ejcp v14) with SMTP;
    10 Sep 2004 16:05:50 -0700
Received: (qmail 8361 invoked from network); 10 Sep 2004 22:50:00 -0000
Received: from unknown (HELO dev2) (127.0.0.1)
  by localhost with SMTP; 10 Sep 2004 22:50:00 -0000
To: mailto:jader@bread.com
From: mailto:jade-test@rubick.com
Subject: test
Date: Fri, 10 Sep 2004 22:50:00 GMT
Precedence: list
MIME-Version: 1.0
Content-ID: <mailto:8302.1094856600.3@dev2.bread.com>
Content-Type: multipart/alternative;
              boundary="----- =_NWUyYmVlNjIwNWMzYmE4NmExOGMwY2VlNGY0NTRlY2Q="
Message-Id: <mailto:717295112.1094856600.oacs@bread.com>

------- =_NWUyYmVlNjIwNWMzYmE4NmExOGMwY2VlNGY0NTRlY2Q=
MIME-Version: 1.0
Content-ID: <mailto:8302.1094856600.2@dev2.bread.com>
Content-Type: text/plain;
              charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

*bold* hey there =5B1=5D

=5B1=5D http://www.rubick.com=20

------- =_NWUyYmVlNjIwNWMzYmE4NmExOGMwY2VlNGY0NTRlY2Q=
MIME-Version: 1.0
Content-ID: <mailto:8302.1094856600.1@dev2.bread.com>
Content-Type: text/html;
              charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<b>bold</b> <a href=3D=22http://www.rubick.com=22>hey there</a>

------- =_NWUyYmVlNjIwNWMzYmE4NmExOGMwY2VlNGY0NTRlY2Q=--

===========================================

With rollout support off, this looks great:

===========================================
Return-Path: <mailto:intranet-446-7EE6D9DA2E648288D594A3850C660A6D5D06A985-500@bread.com>
Delivered-To: mailto:jade@rubick.com
Received: (qmail 3621 invoked from network); 10 Sep 2004 23:38:47 -0000
Received: from mail.bread.com (HELO bread.com) (64.122.45.238)
  by 0 with SMTP; 10 Sep 2004 23:38:47 -0000
Received: (qmail 27531 invoked by uid 1030); 10 Sep 2004 16:10:26 -0700
Delivered-To: mailto:jader@bread.com
Received: (qmail 27529 invoked from network); 10 Sep 2004 16:10:26 -0700
Received: from unknown (HELO dev.bread.com) (192.168.1.14)
    by maildeb (qmail 1.03 + ejcp v14) with SMTP;
    10 Sep 2004 16:10:26 -0700
Received: (qmail 8389 invoked by uid 1004); 10 Sep 2004 22:54:37 -0000
From: mailto:jade-test@rubick.com
To: Jade Rubick <mailto:jader@bread.com>
Subject: test
Date: Fri, 10 Sep 2004 22:54:37 GMT
Precedence: list
MIME-Version: 1.0
Content-ID: <mailto:8381.1094856877.3@dev2.bread.com>
Content-Type: multipart/alternative;
              boundary="----- =_Yjg3MDJmNzJmMWFkZGNhY2VhM2M0MTBiOWQ3ZDhmZTQ="
Message-Id: <mailto:993995268.1094856877.oacs@bread.com>

------- =_Yjg3MDJmNzJmMWFkZGNhY2VhM2M0MTBiOWQ3ZDhmZTQ=
MIME-Version: 1.0
Content-ID: <mailto:8381.1094856877.2@dev2.bread.com>
Content-Type: text/plain;
              charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

*bold* hey there =5B1=5D

=5B1=5D http://www.rubick.com=20

------- =_Yjg3MDJmNzJmMWFkZGNhY2VhM2M0MTBiOWQ3ZDhmZTQ=
MIME-Version: 1.0
Content-ID: <mailto:8381.1094856877.1@dev2.bread.com>
Content-Type: text/html;
              charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<b>bold</b> <a href=3D=22http://www.rubick.com=22>hey there</a>

------- =_Yjg3MDJmNzJmMWFkZGNhY2VhM2M0MTBiOWQ3ZDhmZTQ=--

===========================================

For reference, this is the content of the pm::util::email proc:
===========================================

    # HTML portions of this copied from notification::email::send

    set body_text [ad_html_text_convert -from $mime_type -to "text/plain" -- $body]
    set body_html $body

    # Use this to build up extra mail headers
    set extra_headers [ns_set new]

    # This should disable most auto-replies
    ns_set put $extra_headers Precedence list

    set message_data [build_mime_message $body_text $body_html]
    ns_set put $extra_headers MIME-Version [ns_set get $message_data MIME-Version]
    ns_set put $extra_headers Content-ID [ns_set get $message_data Content-ID]
    ns_set put $extra_headers Content-Type [ns_set get $message_data Content-Type]
    set content [ns_set get $message_data body]

    foreach to $to_addr {

        acs_mail_lite::send \
            -to_addr  "$to" \
            -from_addr "$from_addr" \
            -subject "$subject" \
            -body $content \
            -extraheaders $extra_headers
    }

===========================================

Any suggestions? I'd like to fix this for everyone, but I haven't been able to as of yet.

Another comment: HTML email probably won't work at all unless you copy Jeff's fixes for acs-tcl/tcl/html-email-procs.tcl into your OpenACS 5.1.1 installation from the tip of the oacs-5-1 branch. Those fixes will be included in 5.1.2.

See also my bug report: https://openacs.org/bugtracker/openacs/bug?bug%5fnumber=2097

The rollout support stuff doesn't expect or try to accomodate HTML mails.  It pastes the original message body inside a warning message ("The following email would have been sent...").  See /packages/acs-tcl/tcl/rollout-email-procs.tcl.

So I guess I wouldn't be surprised if this was broken for some mail readers.  In Thunderbird, the HTML version, which doesn't include the warning, is displayed.  But when I look at the message source, the warning text is there.

It's odd that the rollout support warning doesn't show up in your message source.