def notStudent(self, senderNameAndEmail): print("NOT STUDENT '{}'".format(senderNameAndEmail["email"])) msg = "Hi! Your mail was not sent from the domain {}. This service exists solely for the".format( HHSTUDENTMAILDOMAIN) mail = Mail(senderNameAndEmail["email"], msg) mail._send()
def deleteStudent(self, senderNameAndEmail): print("DELETE for {}".format(senderNameAndEmail["email"])) state = pd.read_csv("lib/state.csv") mask = state[state.email == senderNameAndEmail["email"]] vask = state[mask] msg = "Deleted the following rows from the database: {}".format( vask.to_html()) mail = Mail(senderNameAndEmail["email"], msg) mail._send() state[~mask].to_csv("lib/state.csv", index=False)
def studentStatus(self, senderNameAndEmail): print("STATUS for {}".format(senderNameAndEmail["email"])) state = pd.read_csv("lib/state.csv") rows = state[state.email == senderNameAndEmail["email"]] if rows.empty: msg = "Hi! The database doesn't have anything at all on you. Cheers!" else: msg = "Hello {}, here's what the database has about you.<br>{}<br>Cheers!".format( senderNameAndEmail["name"].split(" ")[0], rows.to_html()) mail = Mail(senderNameAndEmail["email"], msg) mail._send()
def infoMailAdmin(self, mailText, receiver=None): if receiver == None: receiver = self.ownerEmails[0] mail = Mail(receiver, mailText) mail._send()