HiraokaHyperTools / msgreader

40 stars 9 forks source link

Getting type of email like calendar, notes #18

Closed satishs37 closed 3 years ago

satishs37 commented 3 years ago

Is there any possibility to get the type of email? Like, whether email is calender ,invite email, or notes or normal email

kenjiuno commented 3 years ago

Hi. I'm not professional of msg file. Could you describe the detail of them? calender, invite email, notes, or normal.

mynpmpackage commented 3 years ago

To create .msg file for Calendar/Invite =>

Opened outlook calendar and dragged out an email to desktop Trying to read the .msg file from desktop using msgreader MsgReader will parse email correctly and builds the properties

Here, I am trying to use the extracted properties which says this is not an email sent from others and this is a calendar invite.

Below are the validations I check using the parsed properties to differentiate emails from Meeting Invites, Notes

To try this validation and to allow only emails sent from others as success case.

if (
        // Not an Email- Meeting Invite from file system
        emailItem.creatorSMTPAddress &&
        emailItem.senderName &&
        emailItem.senderEmailAddress === undefined &&
        emailItem.headers === undefined
      ) {
        return {
          emailType: EmailType.invalid, //failed case
          emailSubject: emailEntity.emailSubject,
        };
      }

Not able to differentiate this email type as the properties are all same for email and calendar.

Like the above, tried for notes/Email contacts

To create this notes/email contacts as .msg file to desktop,

Opened outlook and dragged out notes or contacts to desktop Read the dragged out .msg file using msgreader MsgReader will parse email correctly and builds the properties

if (
        // Notes and Email Contacts
        emailItem.creatorSMTPAddress === undefined &&
        emailItem.senderName === undefined &&
        emailItem.senderEmailAddress === undefined &&
        emailItem.headers === undefined &&
        emailItem.emailRecipients === ''
      ) {
        return {
          emailType: EmailType.invalid,
          emailSubject: emailEntity.emailSubject,
        };
      }

Note : Above validation helps to get to know as this is invalid email and it is notes

Instead of using the above checks, Is there any properties which tells us email is calendar/Invite?

kenjiuno commented 3 years ago

Thanks a lot, please try 1.10.0-alpha.1

mynpmpackage commented 3 years ago

Thanks for quick fix.

Will check the build and let you know asap.

mynpmpackage commented 3 years ago

I am trying to use CLI as my local registry of npm is still not updated and being refreshed.

I get below error when do yarn after downloading

image

image

kenjiuno commented 3 years ago

@mynpmpackage Please check the version of tools,

H:\Proj\msgreader>node -v
v14.17.3

H:\Proj\msgreader>yarn tsc -v
yarn run v1.22.4
$ H:\Proj\msgreader\node_modules\.bin\tsc -v
Version 4.4.4
Done in 0.34s.

H:\Proj\msgreader>yarn -v
1.22.4
mynpmpackage commented 3 years ago

node v=> v14.15.3 tsc=> yarn run v1.22.5 tsc -v => Version 4.4.2 Done in 1.95s. yarn=>1.22.5

previous versions of msgreader was supporting the same versions, is current msgreader uses different versions?

mynpmpackage commented 3 years ago

Thanks for the fix.

Now able to get the difference between normal email and calendar/notes/tasks/contacts. Could you please release the fix?

I tested with package and CLI still facing same issues.

kenjiuno commented 3 years ago

I wonder about part ../../node_modules/@types/inquirer/index.d.ts in output.

Please try latest master branch. It is https://github.com/HiraokaHyperTools/msgreader/commit/84942ec98ab6a40fcf05bda82a97ba97fec0d24a

This commit contains fix imported from these advices:

mynpmpackage commented 3 years ago

CLI now works and helped to test the calendar, notes, email contacts.

Could you please release 1.10.0 version?

kenjiuno commented 3 years ago

OK 1.10.0 is published just now.

mynpmpackage commented 3 years ago

Thanks for publishing new version.

We can close this request/issue.

kenjiuno commented 3 years ago

Thx closing