Mailman/PHP/Digest Issue
![](https://secure.gravatar.com/avatar/cd5c5df75ed56f55110dd64c78ae39d6.jpg?s=120&d=mm&r=g)
Hey All, My apologies in advance if I'm directing this to the wrong location, but I'm about out of ideas. I recently built a small PHP web form to allow individuals to send email updates to our various mailman lists. Everything works quite nicely for non-digest users, but when I tried to configure the script for digest users, things started to get weird. Initially, no matter how many emails I dispatched using the form, the Mailman digest always listed a single topic. In the MIME digest it attached a single message (the first message sent to the list) and in plaintext it appended all the messages sent to the list but still listed as a single message. The headers where all subsequent messages were to start seemed pretty messed up. So I decided to play with the headers a bit and added the line in the php: $headers .= "X-Mailer: PHP/" . phpversion() . "\n"; After that change all digests calculated the number of messages correctly and displayed the headers accurately. Unfortunately, though every thing looks good in digest/plaintext, digest/MIME was acting up. When a MIME digest was received in Outlook, the messages were not attached to the digest. Yet when I sent to a gmail account they appeared below as forwarded messages. Now if I forsake the php form and send MIME email from outlook to the list Outlook correctly creates a multipart/alternative email and the MIME/digest contains appropriate attachments for all messages. Below I list the headers that I'm setting in php, the relevant sections of the plaintext digest with incorrectly counted messages/topics and finally the relevant sections of the plaintext digest with the correct message count. Thanks in advance to anyone who has any thoughts php:
$boundary='--' . md5( uniqid("IsNealAGenius") ); $headers = "From: \"Home Office\" <" . $from. ">\n"; $headers .= "Mime-Version: 1.0\n"; $headers .= "Content-type: multipart/alternative;\n boundary=\"$boundary\"\n X-Mailer: PHP/" . phpversion() . "\n";
$message="\nThis is a multi-part message in MIME format.\n"; $message.="\n\n--$boundary\n"; $message.="Content-Type: text/plain; charset=\"us-ascii\"\n"; $message.="Content-Transfer-Encoding: 8bit\n\n"; $mail_to = "test_list@here.com"; $message .= strip_tags($test); $message .= "\n\n--$boundary\n"; $message .= "Content-Type: text/html; charset=\"us-ascii\"\n"; $message.="Content-Transfer-Encoding: 8bit\n\n"; $message .= $test; mail ($mail_to,"test",$message,$headers); ...................................................................................... plaintext digest 1. Today's Topics:
- test (Home Office)
Date: Wed, 21 Sep 2005 10:19:36 -0400 (EDT) From: "Home Office" neal@here.com To: test_list@here.com Subject: [Test_list] test Message-ID: 20050921141936.AF158524114@mail.here.com Content-Type: multipart/alternative; boundary="--274280a87c2f32840e53791334dfb49f" MIME-Version: 1.0 Precedence: list Message: 1
This is a multi-part message in MIME format.
----274280a87c2f32840e53791334dfb49f Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit
<stripped HTML here.>
----274280a87c2f32840e53791334dfb49f Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: 8bit
<Real HTML here>
----274280a87c2f32840e53791334dfb49f--
List-Archive: </heremail> List-Post: <*mailto:test_list@here.com* <test_list@here.com>> List-Help: <*mailto:test_list-request@here.com?subject=help*<test_list-request@here.com?subject=help>
List-Subscribe: <*http://www.here.com/mailman/listinfo/test_list*<http://www.here.com/mailman/listinfo/test_list>
, <*mailto:test_list-request@here?subject=subscribe*<test_list-request@here?subject=subscribe>
This is a multi-part message in MIME format.
----921e4b971d970fe077e26dadad939251 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit .....
<Rest of message>
............................................................
plaintext digest #2:
Today's Topics:
- test (Home Office)
- test (Home Office)
- test (Home Office)
Date: Wed, 21 Sep 2005 09:56:42 -0400 (EDT) From: "Home Office" neal@here.com To: test_list@here.com Subject: [Test_list] test Message-ID: 20050921135642.7C15B52406B@mail.here.com Content-Type: multipart/alternative; boundary="--c9dff2da6d2e9942c846b891d664122e" X-Mailer: PHP/4.3.2 MIME-Version: 1.0 Precedence: list Message: 1
This is a multi-part message in MIME format.
----c9dff2da6d2e9942c846b891d664122e Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit
<Plain text here>
----d9d51c58d8acd322402f930ba7754354 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: 8bit
<HTML here>
----01f73f678c4ca55f470d0225d6131bb2
Date: Wed, 21 Sep 2005 13:28:37 -0400 (EDT) From: "Home Office" neal@here.com To: test_list@here.com Subject: [Test_list] test Message-ID: 20050921172837.6110952406B@mail.here.com Content-Type: multipart/alternative; boundary="--7cdc89be99811720df8db7a5ddb7bc0e" X-Mailer: PHP/4.3.2 MIME-Version: 1.0 Precedence: list Message: 2
This is a multi-part message in MIME format.
----7cdc89be99811720df8db7a5ddb7bc0e Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit
<rest of message>
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Neal Berwick wrote: Date: Wed, 21 Sep 2005 13:58:46 -0400
My apologies in advance if I'm directing this to the wrong location, but
My apologies for not responding sooner, but your post got buried in my inbox.
<snip>
At this point it appears you are missing
$message .= "\n\n--$boundary--\n";
mail ($mail_to,"test",$message,$headers); ......................................................................................
<snip>
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Neal Berwick wrote: Date: Wed, 21 Sep 2005 13:58:46 -0400
My apologies in advance if I'm directing this to the wrong location, but
My apologies for not responding sooner, but your post got buried in my inbox.
<snip>
At this point it appears you are missing
$message .= "\n\n--$boundary--\n";
mail ($mail_to,"test",$message,$headers); ......................................................................................
<snip>
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro
-
Neal Berwick