You are on page 1of 10

A.

What  is  the  motivation  of  this  application?  How  is  this  application
useful?
My this application informs a manager when a file is submitted by
department of business. As a manager supervises all the departments, it is
necessary that he aware of all the development. Due to his busy routine he
may miss some important update. In order to solve this issue, my this
application will help him/her when an important update is released in the
form of document. This application will help to inform the manager of any
business when a final development or a plan is approved by the head and its
ordinates of department e.g. finance, marketing etc.
B.   What  is  the  novelty  of  this  work?  

It is to provide an ease to the person to access anything without visiting the


business portal. Some of the time the managers miss an update, or maybe
there is a need to upload the finalized plan or development to be shared with
every one, in order to inform about this the manager will be informed
automatically by the email generation. It will be a new step towards how the
work is being shared with the workers using the business forum and without
extra overhead of generating or informing person/manager.

C. Why  was  creating  this  application  nontrivial?  What  challenges  did


you  face  creating  this  application,  and  how  did  you  solve  those
challenges?

My application will help to inform a person assuming it is the head,


whenever a some business document is uploaded. It will automatically
generate an email without an overhead of time. The main problem that I
faced was , getting the form values from the fields and getting them in my
python server. I passed all the information by getting the URL which has
appended value of the form fields and passed it into the email massage. I
wanted to add the database but could not get it how to be done.

D. How  does  the  program  work?  You  should  firstly  provide  a  big
picture  overview  of  what  you’re  trying  to  do.    You  should  then
provide  a  detailed  exposition  of  what  specific  steps  you’ve  taken.
You  should  include  your  code  in  the  submitted  assignment  both  as
part  of  the  report,  and  also  as  an  executable  file  (and  supply  the
source  files )?
For my application I have made a web server in python. My basic idea is to
build an automated email messenger. For my I application I have assumed a
business portal that is owned by a specific business company. All the
proposals and business views are discussed here to bring all the employees
on a common platform. I have tried to implement a module of that idea and
prepared a submission page where I have classified the business employees
into their category like finance, marketing etc. .my idea was that as in the
business various phases are involved where the documentation for the
proposal or incremental work has to be submitted. So my html page has the
option to upload the file where all the workers are able to view it. After
submission the file will be submitted to server. Now the server script will
use SMTP method to send an email to the manager who supervises all the
departments. It will inform the manager that by particular employee of the
following department has uploaded the document. Moreover it will also
provide a quick link to view the file. All is done to give an ease to the
manager and remove an overhead as he has many responsibilities and may
not have time to visit the portal regularly.

CODE
For testing provide valid emails and password

import cgi

import smtplib

from email.mime.multipart import MIMEMultipart

from email.mime.text import MIMEText

import urlparse
from socket import *

serverSocket = socket(AF_INET, SOCK_STREAM)

serverSocket.bind(('localhost',8699))

serverSocket.listen(1)

i=0

while True:

print 'The SERVER is ready to serve'

i=i+1

connectionSocket, addr = serverSocket.accept()

try:

message=connectionSocket.recv(1024)

print ("-------- REQUEST INFO ---------")

print (message)

print ("-------- INFO END ---------")

filename = message.split()[1]

print ("Requested File: " + filename)


f = open(filename[1:])

outputdata = f.read()

print outputdata

url1 = filename

par = urlparse.parse_qs(urlparse.urlparse(url1).query)

print par

print par

print url1

connectionSocket.send('\n HTTP/1.1 200 OK\r\n')

connectionSocket.send('Content-Type: text/html\r\n')

datalength = 'Content-Length: '+str(len(outputdata))+'\r\n'

connectionSocket.send(datalength)

connectionSocket.send('\n')
url1 = filename

par = urlparse.parse_qs(urlparse.urlparse(url1).query)

print par

for i in range(0, len(outputdata)):

connectionSocket.send(outputdata[i])

form = cgi.FieldStorage()

seachterm = form.getvalue('filename')

print seachterm

connectionSocket.close()

to = 'manger@gmail.com'

gmail_user = 'user@gmail.com'

gmail_user1 = 'user@gmail.com'
gmail_pwd = 'password'

msg= MIMEMultipart('alternative')

msg['Subject'] = "Link"

msg['From'] = gmail_user

msg['To'] = to

text = "Hi!\nThis is to inform you that a Plannner for this week has been added\nHere is
the link you wanted:\nhttp://localhost:8699/confirm.html"

part1 = MIMEText(text, 'plain')

msg.attach(part1)
smtpserver = smtplib.SMTP("smtp.gmail.com",587)

smtpserver.ehlo()

smtpserver.starttls()

smtpserver.ehlo

smtpserver.login(gmail_user, gmail_pwd)

header = 'To:' + to + '\n' + 'From: ' + gmail_user1 + '\n' + 'Subject:Planner Added by a


Employee \n'

print header
msg1 = header + '\n Notification for a planner \n\n' + message + msg.as_string()

smtpserver.sendmail(gmail_user1, to, msg1)

print 'done!'

smtpserver.close()

print par

except IOError:

print 'IOERROR'

connectionSocket.send('\n')

displayError = '404 Not Found: The page was not on Server'

connectionSocket.send(displayError)

connectionSocket.close()

print url1

serverSocket.close()
HTML Page
<!DOCTYPE html>

<html>

<body>

<center><h1>Bussiness Forum Blog</h1></center>

<center><h1>Planner for the Week</h1></center>

<form action="confirm.html" method="post" name="search"


enctype="multipart/form-data">

<table>

<tr><td><b>Name: </b></td><td><input type="text"


name="firstname"></td></tr><br>

<tr><td><b>Department: </b></td><td><select name="dep">

<option value="Finnance">Finnance</option>
<option value="HR">HR</option>

<option value="Events">Events</option>

<option value="Marketing">Marketing</option>

</select></td></tr><br>

<tr><td><b>Supervisor name: </b></td><td><input type="text"


name="sname"></td></tr><br>

<tr><td><b>Status: </b></td><td> <select name="status">

<option value="sapproved">Approved By Supervisor</option>

<option value="happroved">Approved By Head</option>

</select>

</td></tr><br>

<tr><td><b>Email Address: </b></td><td><input type="text"


name="email"></td></tr><br>

<tr><td><b>Upload the Planner file: </b></td><td><input type="file"


name="filename" /></td></tr>

</table>
<input type="submit" value="Upload">

</form>

</body>

</html>

You might also like