File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
projects/Store_emails_in_csv Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3- import imaplib
3+ import csv
44import email
55from email import policy
6- import csv
7- import ssl
6+ import imaplib
87import os
8+ import ssl
9+
910from bs4 import BeautifulSoup
1011
12+
1113credential_path = os .getcwd () + "/credentials.txt"
1214csv_path = os .getcwd () + "/mails.csv"
1315
@@ -88,8 +90,7 @@ def write_to_csv(mail, writer):
8890 writer .writerow (row )
8991
9092
91- if __name__ == "__main__" :
92-
93+ def main ():
9394 mail , messages = connect_to_mailbox ()
9495
9596 total_no_of_mails = int (messages [0 ])
@@ -104,3 +105,7 @@ def write_to_csv(mail, writer):
104105 write_to_csv (mail , writer )
105106 except Exception as e :
106107 print (e )
108+
109+
110+ if __name__ == "__main__" :
111+ main ()
You can’t perform that action at this time.
0 commit comments