feisty meow concerns codebase 2.140
eml_to_txt Namespace Reference

Functions

 file_exists (f)
 
 save_file (fn, cont)
 
 construct_name (id, fn)
 
 disqo (s)
 
 disgra (s)
 
 pullout (m, key)
 
 extract (msgfile, key)
 
 clean_header (h)
 
 caption (origin)
 

Variables

str startdirname = "Email"
 
int num = 1
 
 nam = i[:-4]
 
str path = "./" + startdirname + str(num) + "/" + nam
 
 f = open(i, "r")
 
 emailDict = extract(f, f.name)
 
str textFile = ""
 
 froms = emailDict["from"]
 
 tos = emailDict["to"]
 
 subject = emailDict["subject"]
 
 parts = emailDict["parts"]
 
 date = emailDict["date"]
 
 txt = emailDict["text"]
 
 html = emailDict["html"]
 
list files = []
 
 wf = open("./" + startdirname + str(num) + "/" + nam + "/" + "txt_" + nam + ".txt", "w")
 

Detailed Description

started from free license script posted on stackexchange:
https://softwarerecs.stackexchange.com/questions/28138/converter-that-converts-eml-files-to-plain-text?newreg=48fb884924fd4d909777e5fccc8af2eb

Chris Koeritz: added processing to fix headers and to turn html parts into text 2023-11-08.

Function Documentation

◆ caption()

eml_to_txt.caption (   origin)

Definition at line 112 of file eml_to_txt.py.

References clean_header().

Referenced by extract().

◆ clean_header()

eml_to_txt.clean_header (   h)

Definition at line 109 of file eml_to_txt.py.

Referenced by caption().

◆ construct_name()

eml_to_txt.construct_name (   id,
  fn 
)

Definition at line 24 of file eml_to_txt.py.

Referenced by pullout().

◆ disgra()

eml_to_txt.disgra (   s)

Definition at line 35 of file eml_to_txt.py.

Referenced by pullout().

◆ disqo()

eml_to_txt.disqo (   s)

Definition at line 29 of file eml_to_txt.py.

Referenced by pullout().

◆ extract()

eml_to_txt.extract (   msgfile,
  key 
)

Definition at line 99 of file eml_to_txt.py.

References caption(), and pullout().

◆ file_exists()

eml_to_txt.file_exists (   f)

Definition at line 16 of file eml_to_txt.py.

Referenced by pullout().

◆ pullout()

eml_to_txt.pullout (   m,
  key 
)

Definition at line 40 of file eml_to_txt.py.

References construct_name(), disgra(), disqo(), file_exists(), pullout(), and save_file().

Referenced by extract(), and pullout().

◆ save_file()

eml_to_txt.save_file (   fn,
  cont 
)

Definition at line 19 of file eml_to_txt.py.

References open.

Referenced by pullout().

Variable Documentation

◆ date

eml_to_txt.date = emailDict["date"]

Definition at line 153 of file eml_to_txt.py.

◆ emailDict

eml_to_txt.emailDict = extract(f, f.name)

Definition at line 144 of file eml_to_txt.py.

◆ f

eml_to_txt.f = open(i, "r")

Definition at line 143 of file eml_to_txt.py.

◆ files

list eml_to_txt.files = []

Definition at line 157 of file eml_to_txt.py.

◆ froms

eml_to_txt.froms = emailDict["from"]

Definition at line 149 of file eml_to_txt.py.

◆ html

eml_to_txt.html = emailDict["html"]

Definition at line 155 of file eml_to_txt.py.

◆ nam

eml_to_txt.nam = i[:-4]

Definition at line 138 of file eml_to_txt.py.

◆ num

int eml_to_txt.num = 1

Definition at line 127 of file eml_to_txt.py.

◆ parts

eml_to_txt.parts = emailDict["parts"]

Definition at line 152 of file eml_to_txt.py.

◆ path

str eml_to_txt.path = "./" + startdirname + str(num) + "/" + nam

Definition at line 139 of file eml_to_txt.py.

◆ startdirname

str eml_to_txt.startdirname = "Email"

Definition at line 126 of file eml_to_txt.py.

◆ subject

eml_to_txt.subject = emailDict["subject"]

Definition at line 151 of file eml_to_txt.py.

◆ textFile

str eml_to_txt.textFile = ""

Definition at line 147 of file eml_to_txt.py.

◆ tos

eml_to_txt.tos = emailDict["to"]

Definition at line 150 of file eml_to_txt.py.

◆ txt

eml_to_txt.txt = emailDict["text"]

Definition at line 154 of file eml_to_txt.py.

◆ wf

eml_to_txt.wf = open("./" + startdirname + str(num) + "/" + nam + "/" + "txt_" + nam + ".txt", "w")

Definition at line 172 of file eml_to_txt.py.