Module marksman.mailer
Module to implement the email functionality
Classes
class Mailer (server: smtplib.SMTP, cursor: sqlite3.Cursor, sender: str, inst: str, exam_uid: int)
-
Class to implement related methods for sending emails to students
Constructor to initialize the mailer object
Args
server
:SMTP
- SMTP sever object, which is logged in and ready to send mails
cursor
:Cursor
- sqlite3 cursor object
sender
:str
- email address of sender
inst
:str
- institute name of sender
exam_uid
:int
- uid of the exam, whose results are to be mailed
Methods
def get_exam_name(self) ‑> str
-
Fetches the name of the exam of the current Mailer object
Returns
[str]
- name of exam
def get_files(self) ‑> list
-
Plot the necessary graphs and return a list of file paths
Returns
list
- file paths
def mail_all_students(self)
-
Method to loop over all students marks entries for the exam and send them emails. Updates the self.recipients and calls self.send_mail in every iteration.
def parse_template(self) ‑> str
-
Access any variable in your template by ::name:: style
List of variables passed to template 1. name 2. roll 3. email 4. exam 5. marks 6. rank 7. highest 8. average 9. inst
Returns
str
- the template string
def send_mail(self) ‑> bool
-
Send an email to the current recipient
Returns
bool
- status of sending