#10 Collapse Embedded, Quoted Headers

open
nobody
5
2012-10-16
2011-04-08
ColdForest
No

As per the original post to the help board:

Request to have the macro not condense embedded, quoted Outlook headers? For e.g., the following:

-----Original Message-----
From: Adam Swift
Sent: April 7, 2011 9:52 AM
To: Art Ross
Cc: Drift Over
Subject: RE: Testing

-----Original Message-----
From: Art Ross
Sent: Thursday, April 07, 2011 9:36 AM
To: Adam Swift
Cc: Drift Over
Subject: RE: Testing

Hi Adam,

converted to:

On 2011-04-07, Adam Swift wrote:

On 2011-04-07, Art Ross wrote:
Hi Adam,

Discussion

  • Oliver Kopp
    Oliver Kopp
    2011-04-23

    The feature should be implemented in revision 83 in the trunk version in the SVN. Please check if it works for you as desired.

     
  • ColdForest
    ColdForest
    2011-04-25

    Hi there, thanks for looking into this!

    Just wanted to clarify one thing above: the request is to "condense embedded, quoted Outlook headers" (as opposed to "not condense..." - although both are supported via the CONDENSE_EMBEDDED_QUOTED_OUTLOOK_HEADERS :)).

    I've tried this on a couple example emails and one works great, while the other one fails on line 516 (dDate = DateValue(sDate)). The date in question seems to be valid ("Monday, April 18, 2011 3:11 PM"), however, this line trips a "Type mismatch" error in VBA. Any ideas?

     
  • ColdForest
    ColdForest
    2011-04-25

    One other thing: I notice that the headers aren't quite preserved correctly when CONDENSE_EMBEDDED_QUOTED_OUTLOOK_HEADERS is false. I see some headers go from multi-line to being concatenated to a single line (up to ~70 characters in length).

     
  • ColdForest
    ColdForest
    2011-04-27

    Hi Olly, I just checked out the latest trunk tip and this seems to work better (once I figured out the new constant and merged in my minor tweaks). I now see proper date handling for condensing embedded headers. There are still a couple minor items that surfaced, but I'll need to review these before I provide more details.
    Cheers.

     
  • ColdForest
    ColdForest
    2011-04-28

    Back again ;). OK, I did notice several things that could still be tweaked. In particular these surround scenarios where the embedded Outlook header isn't formatted absolutely correctly. For example, I've seen some mailers mangle the original Outlook header as follows:

    1.
    ...

    -----Original Message----- From: Test One
    test@abc.com
    To: Test Two test2@abc.com, Test Three
    test3@abc.com, Test Four
    test4@netacquire.com
    Cc: Test Five test5@abc.com Subject: RE: Test
    Question
    Date: Tue, 26 Apr 2011 14:05:13 +0000

    and 2.

    ....

    -----Original Message-----
    From: David Hauck [mailto:davidh@netacquire.com]
    Sent: 2011, April, 28 3:05 PM
    To: Tepes-Nica, Ioan
    Cc: Celia Brinkerhoff (cbrinkerhoff@telus.net)
    Subject: RE: Cheque

    Replying to #1 results in another "Type mismatch" error at line 552 (with 'sDate' equal to "Test Three".

    Replying to #2 results in the header being ignored by the embedded header condensation portion of the macro. I believe this has something to do with the nesting level being out of whack. The key thing with #2 is that the message being replied to contains the embedded header without any prefix at the beginning of the header lines.

     
  • ColdForest
    ColdForest
    2011-04-28

    Just another quick comment here: I've also added a MY_SIGNATURE string constant that defines a specific signature specification. This prevents me from having to define a global signature in Outlook (which I don't like to do). This constant is then used in the FixMailText subroutine to prepend the constant to the BodyLines array.

    BTW, the line number is incorrect in my previous comment due to this addition. The "Type mismatch" occurs at the 'dDate = DateValue(sDate)' line...

     
  • Further to example #1 below: I see that this is because the condensation code expects to see the "date" as the second row (after the "Name" row) and when this isn't the case (as in #1 below) the type mismatch on DateValue() occurs. For robustness the condensation code should probably do something like: posColon = InStr(sDate, "Sent:") in order to match the proper line. If the match doesn't occur either skip lines until a match is found (up to the end of the header) or just ignore this header (and allow it to pass through un-condensed). Thanks.

     
  • ColdForest
    ColdForest
    2011-04-29

    Getting closer - just checked out r93. Variation in dates continue to get handled better. However, when the recognized embedded header does not contain a valid date row as the row immediately after the "Name" row the results are incorrect. In these cases the dDate and dTime variables have stale values (actually equal to the values obtained from the previously condensed header) and so the condensation is incorrect. I think it would be better to not condense individual headers if their syntax is unrecognizable (i.e., just output the header as-is in these cases).

     
  • ColdForest
    ColdForest
    2011-05-03

    The latest (r95) version does not seem to be handling default "Sent:" date formats properly. In is incorrectly skipping past the comma in fields like "Sent: January 27, 2011 4:15 PM" - as it attempts to skip what it thinks is the "day" token of the date string. Perhaps the condesation code should be checking first to see if two commas are present before skipping the first comma separated token?

     
  • ColdForest
    ColdForest
    2011-05-03

    The item mentioned below (regarding the optional presence of the "day" token with the sent date can be handled as follows:

                    Dim sDate As String
                    sDate = StripLine(rows(i))
                    posColon = InStr(sDate, ":")
                    'sDate = mid(sDate, posColon + 2)
                    Dim posFirstComma As Integer
                    Dim posSecondComma As Integer
                    posFirstComma = InStr(sDate, ",")
                    posSecondComma = InStrRev(sDate, ",")
                    If posFirstComma <> posSecondComma Then
                        sDate = mid(sDate, posFirstComma + 2)
                    Else
                        sDate = mid(sDate, posColon + 2)
                    End If
    
     


Anonymous


Cancel   Add attachments