Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to PyMail

We'd love for you to contribute to our source code and to make AngularJS even better than it is
We'd love for you to contribute to our source code and to make PyMail even better than it is
today! Here are the guidelines we'd like you to follow:

- [Code of Conduct](#coc)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PyMail
#### A simple Python GUI based SMTP and POP3 Client
----------------------------------------------------------
-----------------------------------------------------------

## Setup
- Clone the repo:
Expand All @@ -21,5 +21,7 @@ MESSAGE_LIMIT = 20
python main.py
```

- In order to modify GUI using Qt-Designer, modify the .ui files in components and execute ```./run.sh``` to generate the corresponding .py files

## License
[MIT License](http://anshul.mit-license.org/)
File renamed without changes.
2 changes: 1 addition & 1 deletion components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import compose
import login_dash
import dashboard
import mainwindow
File renamed without changes.
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from receive_module import *
import sender_module
import sys,os
from components import mainwindow,compose,login_dash
from components import mainwindow,compose,dashboard
import conf
from PyQt4 import QtCore as QtCore2

class ControlMainWindow(QtGui.QMainWindow): #Initialize New Window

Expand Down Expand Up @@ -80,7 +79,7 @@ class LoginDashboard(QtGui.QWidget):
#Initialization function that defines the control to listen to
def __init__(self, parent=None):
super(LoginDashboard, self).__init__(parent)
self.ui = login_dash.Ui_Form()
self.ui = dashboard.Ui_Form()
self.ui.setupUi(self)
self.ui.received_email.cellClicked.connect(self.slotItemClicked)
self.ui.compose_button.clicked.connect(self.compose)
Expand Down Expand Up @@ -167,7 +166,7 @@ def send_email(self):
self.ui.subject.setText("")
self.ui.body.clear()

#Discards the data in the body, sender, receiver and subject fields and return to login_dash page
#Discards the data in the body, sender, receiver and subject fields and return to dashboard page
def discard(self):
self.parent().setCurrentIndex(0)
self.ui.sender.setText(self.pop_obj.username)
Expand Down
20 changes: 8 additions & 12 deletions receive_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
import logging
import email

# from email.parser import Parser

# in conf.py put
# username = ---
# password = ---

CRLF = '\r\n'
TERMINATOR = CRLF + '.' + CRLF

Expand Down Expand Up @@ -48,7 +42,6 @@ def send_message(self,m):

# sends a message m without logging
def send_password(self,m):
logging.debug("\nC: *********")
self.sock.send((m + '\r\n').encode('utf-8'))

# sends a message mes and receives a line from socket
Expand Down Expand Up @@ -105,7 +98,7 @@ def __init__(self, host_name, host_port, user_id, passw, log_level=logging.DEBUG
sock.connect((host_name, host_port))
self.connection = True
except Exception as e:
print('can\'t connect to {0} on {1} port \r\n{3}'.format(host, port, e.__repr__()))
print('can\'t connect to {0} on {1} port \r\n{2}'.format(host, port, e.__repr__()))
self.connection = False
return

Expand Down Expand Up @@ -168,7 +161,11 @@ def get_email_body(self, index):
body = ""
if b.is_multipart():
for payload in b.get_payload():
body = body + payload.get_payload()
d = payload.get_payload()
if type(d) is list:
body = body + ','.join(str(v) for v in d)
else:
body = body + str(payload.get_payload())
else:
body = b.get_payload()
body = body.replace("\r","")
Expand All @@ -182,6 +179,5 @@ def get_email_body(self, index):
reload(sys)
sys.setdefaultencoding('utf8')
pop_obj = pop3lib(HOST_ADDR,POP3_PORT,USERNAME,PASSWORD)
# print pop_obj.get_message_list(1,1)
# print pop_obj.get_email_body(14)
# print "DONE"
pop_obj.get_message_count()
pop_obj.get_email_body(1)
2 changes: 1 addition & 1 deletion scr.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pyside-uic UI/compose.ui -o components/compose.py
pyside-uic UI/mainwindow.ui -o components/mainwindow.py
pyside-uic UI/login_dash.ui -o components/login_dash.py
pyside-uic UI/dashboard.ui -o components/dashboard.py