diff options
author | hardythe1 | 2013-11-19 17:57:18 +0530 |
---|---|---|
committer | hardythe1 | 2013-11-19 17:57:18 +0530 |
commit | c55a9304cac3dfc0f8ad77e19086136397f783f0 (patch) | |
tree | 8a1dde9ae8791eb0bebd017337c488b142cf7fd3 | |
parent | aac8f596c18274917bb8fbd1361ce1c80273d5cb (diff) | |
download | Python-TBC-Interface-c55a9304cac3dfc0f8ad77e19086136397f783f0.tar.gz Python-TBC-Interface-c55a9304cac3dfc0f8ad77e19086136397f783f0.tar.bz2 Python-TBC-Interface-c55a9304cac3dfc0f8ad77e19086136397f783f0.zip |
removing LDAP & SMTP Auth
-rw-r--r-- | tbc/views.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/tbc/views.py b/tbc/views.py index d19d7d3..7c3f43b 100644 --- a/tbc/views.py +++ b/tbc/views.py @@ -14,17 +14,16 @@ from email.mime.text import MIMEText def email_send(to,subject,msg): - s = smtplib.SMTP('smtp-auth.iitb.ac.in') - s.starttls() - MAIL_FROM = "textbook@fossee.in" - s.login(LDAP_ID, LDAP_PWD) - message = MIMEText(msg) - message['Subject'] = subject - message['From'] = MAIL_FROM - message['to'] = to - s.sendmail(MAIL_FROM, to, message.as_string()) - s.quit() - + try: + smtpObj = smtplib.SMTP('localhost') + mail_from = "textbook@fosse.in" + message = MIMEText(msg) + message['Subject'] = subject + message['From'] = mail_from + message['to'] = to + smtpObj.sendmail(mail_from, to, message.as_string()) + except SMTPException: + return HttpResponse("Error:unable to send email") def Home(request): context = {} @@ -164,9 +163,9 @@ def ContentUpload(request): book = Book.objects.order_by("-id")[0] subject = "Python-TBC: Book Submission" message = "Hi "+curr_book.reviewer.name+",\n"+\ - "A book has been submitted on the interface.\n"+\ - "Details of the Book & Contributor are:\n"+\ - "Contributor: "+curr_book.contributor.user.first_name+curr_book.contributor.user.last_name+"\n"+\ + "A book has been submitted on the Python TBC interface.\n"+\ + "Details of the Book & Contributor:\n"+\ + "Contributor: "+curr_book.contributor.user.first_name+" "+curr_book.contributor.user.last_name+"\n"+\ "Book Title: "+curr_book.title+"\n"+\ "Author: "+curr_book.author+"\n"+\ "Publisher: "+curr_book.publisher_place+"\n"+\ |