outlook-message-parser icon indicating copy to clipboard operation
outlook-message-parser copied to clipboard

Creator/Modifier of msg file is interfering the identification of the sender email address

Open sanastasiadis opened this issue 1 year ago • 2 comments

In OutlookMessage, in the method setProperty, all the following properties are considered to identify the sender email address, leading to setFromEmail:

  • 0xc1f - Sender email
  • 0x65 - Sent repr email
  • 0x3ffa - Creator2, Last modifier name

(According to: fileformat.info, exchange server protocol)

I think that 0x3ffa property has to be excluded from this check, as the sender is not the same person as the creator/modifier of the msg file.

On top of this, even if the message contains all the above 3 properties, if one of them includes a value in X500 data, it will not be taken into consideration, as setFromEmail forces the value set to always contain "@".

sanastasiadis avatar Apr 18 '24 19:04 sanastasiadis

We have a regex somewhere that detects x500 address and since very recently we have a separate field for x500 address in Recipient (see https://github.com/bbottema/outlook-message-parser/issues/73 and https://github.com/bbottema/outlook-message-parser/pull/75). Perhaps we should have that check here as well, so we don't overwrite an email address if it is present.

bbottema avatar Apr 19 '24 08:04 bbottema

I agree, it's good to have the regex check.

However, in my PR I still use the "force" flag so the occasional normal email address does not get overwritten. The fromEmail will be updated:

  • if the force flag is true (the incoming address includes "@")

OR

  • if the existing value is null (it may contain either a normal email address or X500 data)
if (force || this.fromEmail == null) {
	this.fromEmail = fromEmail;
}

sanastasiadis avatar Apr 19 '24 08:04 sanastasiadis