Drag email from outlook to you web application

Written By H T (Super Administrator)

Updated at August 7th, 2020

Use case

Drag email from outlook and save on web application 


Technical logic

  1. When we drag email from outlook it create file with subject name  and file extension .msg
  2. This file we can drops 
  3. Create simple file drop using normal file drop.
  4. Create table to store file and parse the msg file and store data
  5. Display email like outlook on your web


Example to parse file in python

https://stackoverflow.com/questions/26322255/parsing-outlook-msg-files-with-python


import win32com.client
outlook 
= win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
msg 
= outlook.OpenSharedItem(r"C:\test_msg.msg")

print msg.SenderName
print msg.SenderEmailAddress
print msg.SentOn
print msg.To
print msg.CC
print msg.BCC
print msg.Subject
print msg.Body

count_attachments 
= msg.Attachments.Count
if count_attachments > 0:
    
for item in range(count_attachments):
        
print msg.Attachments.Item(item + 1).Filename

del outlook, msg

Table example

  1.     email
    1. id
    2. sendername
    3. senderemail
    4. to
    5. cc
    6. bcc
    7. subject
    8. body
    9. attachments
    10. file_data(blob)  - store .msg file to parse

NOTE - case_id can be used as foreign key on table.






Was this article helpful?

HeapTrace | Footer
© 2020 HeapTrace Technology Pvt. Ltd. All Rights Reserved