Forum OpenACS Development: Re: How do I send HTML email?

Collapse
Posted by Jade Rubick on
Thanks for the hint, Jeff.

Looking at this further....

I send an email with the following code:

    set to_addr myemail@email.com
    set from_addr myemail@email.com
    set subject "Test"
    set message "<a href=\"http://www.safe4all.org\">http://www.safe4all.org</a>"
    set mime_type "text/html"

    # first of all, set up the HTML and text versions of the message

    set message_html [ad_html_text_convert -from $mime_type -to "text/html" -- $body]

    # some mailers chop off the last few characters.
    append message_html "   "

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

    set message_data [build_mime_message $message_text $message_html]
    
    set extra_headers [ns_set new]
    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 message [ns_set get $message_data body]

    foreach to $to_addr {

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

What I see when I send this to a UNIX mailbox and cat the spool file is:

In the HTML portion of the MIME message:

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

<a href=3D3d=22http://www.safe4all.org=22>http://www.safe4all.org</a>  =20
This seems to look just fine on Microsoft Outlook, but on Apple's Mail.app program, it appears as:
x-msg://46/3d'http://www.safe4all.org'
for some reason.

Any idea why it's not working on the Mac?