Commit e7ea6f3b authored by Olivier's avatar Olivier
Browse files

M4: title of email is defined together with body + general cleanup

parent b3446dd8
# -*- coding: utf-8 -*-
"""
Author: Germán Santa Maria
Author: Germán Santa-Maria
Script: Email Assignments
"""
"""-------------------------Hard coded input--------------------------------"""
# Input files paths
# Input file paths
input_csv_path = 'script_input/output_assignments.csv'
assignments_pdfs_path = 'script_input/'
# Output files paths
# Output file paths
output_csv_path = 'script_output/sent_emails.csv'
# (Hard-coded email settings)
host="myhost.example.com"
port = 587
sender_email = "sender@example.com"
sender_username = "username"
cc = "cc_address@example.com"
sender_username = "username"
password = input("Type your password and press enter:")
# Delay time between sending two emails, in seconds
......@@ -72,8 +72,12 @@ for i in range(0, len(custom_ID_A)):
assignments_pdfs_path+attachments[i]+
' was not found, no emails were sent')
"""-----------------Build email text for each student-----------------------"""
# Write a personalized email body for each student
###########################################################################
# Content specific to assignment exercise
email_subject = "Custom Assignment #1"
standard_body = """Dear XXstudent_nameXX,
I have the pleasure of handing you (attached) your first coursework assignment in our course. I hope you will participate in the program, and have fun doing so! The coursework program has a total of three assignments, and is managed entirely by e-mail. Below, I explain how the program works and what to expect.
......@@ -101,6 +105,8 @@ With best regards,
(author)
"""
###########################################################################
for i in range(0, len(names)):
temp_body = standard_body.replace("XXstudent_nameXX", names[i])
submission_file_name = custom_ID_A[i] + ".pdf"
......@@ -113,7 +119,7 @@ for i in range(0, len(names)):
receiver_email = emails[i]
# Email subject
subject = "Custom Assignment #1 ID_"+custom_ID_A[i]
subject = email_subject
# Email body
body = email_bodies[i]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment