i += 1 except IndexError: obj7.textToSpeech("\nNo more messages") #self.outcome = False return False except imaplib.IMAP4.error: obj7.textToSpeech("Authentication Error! please check your credentials") return False except TypeError: obj7.textToSpeech("No credentials have been provided") return False def fetchSentBox(self): if self.fetchAll(SentBox.lower,SentBox.upper) == True: obj7.textToSpeech("Do you want to read more messages ?") if obj7.hear() in ["yes"]: SentBox.lower -= 5 SentBox.upper -= 4 self.fetchSentBox() else: return obj6 = SentBox() obj7 = first.Menu()
if obj8.hear() in ["yes", "ya", "yeah"]: obj8.textToSpeech(obj10.fetchBody(x)) mail.store(latest_email_id, '-FLAGS', '\\Seen') i += 1 except IndexError: obj8.textToSpeech("\nNo new messages") #self.outcome = False sys.exit() except imaplib.IMAP4.error: obj8.textToSpeech( "Authentication Error! please check your credentials") except TypeError: return ("No credentials have been provided") def fetch(self): self.fetchUnread(Unread.lower, Unread.upper) obj8.textToSpeech("Do you want to read more messages ?") if obj8.hear() in ["yes"]: Unread.lower -= 5 Unread.upper -= 4 self.fetch() obj9 = Unread() obj8 = first.Menu() obj10 = FetchBody.Body() # obj9.fetch()
import smtplib import first class Send: def sendMail(self, receiverId, subject, body): sender = '*****@*****.**' message = """From: {} To: {} Subject: {} {} """.format(obj2.fetchCredential()[2], receiverId, subject, body) try: smtpObj = smtplib.SMTP('smtp.gmail.com', 587) smtpObj.starttls() smtpObj.login(obj2.fetchCredential()[0], obj2.fetchCredential()[1]) smtpObj.sendmail(sender, receiverId, message) return ("Successfully sent email to", receiverId) except smtplib.SMTPException: return ("Error: unable to send email") except TypeError: return ("No credentials have been provided") obj2 = first.Menu() # obj4 = Send() # obj4.sendMail("*****@*****.**","Drag","body")
) obj5.delete(self.erase) obj2.process() elif obj3.command in [ "9", "nine", "show all contacts", "show contacts", "list all contacts", "compose an email", "compose email" ]: obj5.show() obj2.process() else: obj3.textToSpeech("No such cammand") obj3.hear() return obj2 = Listen() obj3 = first.Menu() obj4 = smtplib_send.Send() obj5 = contacts.Contact() obj6 = inbox.Inbox() obj9 = unreadInbox.Unread() #obj10 = FetchBody.Body() obj10 = Sent.SentBox() #obj3.mainMenu() #obj3.textToSpeech("Issue a command") #obj3.welcome() obj2.process()