[Python example] capture the attachment example in the msg letter.

Source: Internet
Author: User

[Python example] capture the attachment example in the msg letter.

To capture the attachment of the msg Letter Writing case and handle it, find the Python module msg-extractor.

This mode is easy to use. However, this mode must be fixed in terminal and cannot be directly attached to the IDLE compiler.

So after a slight modification, you can use the subprocess mode to execute commands.

 

The complete program is available on my Github.

 

 

# The path where the msg parser is placed is srcfilePath = OS. path. join ('C: \ ', 'python2. 7.10 ') # msg alias name fileName = '2017. msg 'def MsgToExcelDatabase (srcfilePath, fileName): MailmsgPath = OS. path. join (srcfilePath, fileName) # Execute command using the subprocess sequence line # start extract attachment from 123.msg DIR = OS. path. join ('C: \ ', 'python2. 7.10 ', 'msg-extractor-Master', 'extractmsg. py') subprocess. call (['python', DIR, MailmsgPath]) # defMsgToExcelDatabase (srcfilePath, fileName) with the correct path and region name)
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.