feisty meow concerns codebase  2.140
eml_to_txt Namespace Reference

Functions

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

Variables

string startdirname = "Email"
 
int num = 1
 
 nam = i[:-4]
 
string path = "./" + startdirname + str(num) + "/" + nam
 
 f = open(i, "r")
 
def emailDict = extract(f, f.name)
 
string textFile = ""
 
def froms = emailDict["from"]
 
def tos = emailDict["to"]
 
def subject = emailDict["subject"]
 
def parts = emailDict["parts"]
 
def date = emailDict["date"]
 
def txt = emailDict["text"]
 
def 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()

def eml_to_txt.caption (   origin)

Definition at line 112 of file eml_to_txt.py.

References clean_header().

Referenced by extract().

◆ clean_header()

def eml_to_txt.clean_header (   h)

Definition at line 109 of file eml_to_txt.py.

Referenced by caption().

◆ construct_name()

def eml_to_txt.construct_name (   id,
  fn 
)

Definition at line 24 of file eml_to_txt.py.

Referenced by pullout().

◆ disgra()

def eml_to_txt.disgra (   s)

Definition at line 35 of file eml_to_txt.py.

Referenced by pullout().

◆ disqo()

def eml_to_txt.disqo (   s)

Definition at line 29 of file eml_to_txt.py.

Referenced by pullout().

◆ extract()

def eml_to_txt.extract (   msgfile,
  key 
)

Definition at line 99 of file eml_to_txt.py.

References caption(), and pullout().

◆ file_exists()

def eml_to_txt.file_exists (   f)

Definition at line 16 of file eml_to_txt.py.

Referenced by pullout().

◆ pullout()

def eml_to_txt.pullout (   m,
  key 
)

Definition at line 40 of file eml_to_txt.py.

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

Referenced by extract().

◆ save_file()

def 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

def eml_to_txt.date = emailDict["date"]

Definition at line 153 of file eml_to_txt.py.

◆ emailDict

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

Definition at line 144 of file eml_to_txt.py.

◆ f

◆ files

◆ froms

def eml_to_txt.froms = emailDict["from"]

Definition at line 149 of file eml_to_txt.py.

◆ html

def 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

◆ parts

def eml_to_txt.parts = emailDict["parts"]

Definition at line 152 of file eml_to_txt.py.

Referenced by versions::version_ini.read_version_from_ini().

◆ path

◆ startdirname

string eml_to_txt.startdirname = "Email"

Definition at line 126 of file eml_to_txt.py.

◆ subject

def eml_to_txt.subject = emailDict["subject"]

Definition at line 151 of file eml_to_txt.py.

◆ textFile

string eml_to_txt.textFile = ""

Definition at line 147 of file eml_to_txt.py.

◆ tos

def eml_to_txt.tos = emailDict["to"]

Definition at line 150 of file eml_to_txt.py.

◆ txt

def 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.