Message Boards Message Boards

[WSS16] Email Management

Students in an online course must take their exams with a pre-approved proctor. At the beginning of the course students fill out proctor forms and send them to the instructor. Throughout the semester various template emails get sent out to the proctors. These emails however need to be individualized so that testing centers know specifically who is taking the exam. Thus a system needs to be created to automate this process as much as possible.

Solution:

  1. Create a process for collecting the proctor form information online.
  2. Create a program to send out email content.

First I will create a data bin:

 bin = CreateDatabin["Name" -> "Proctor Information", 
   "Interpretation" -> {"Student Name" -> "String", 
     "Student Email" -> "String", "Location" -> "String", 
     "Proctor Name" -> "String", "Proctor Email" -> "String", 
     "Proctor Verification" -> "String"}]

Once you runs this code you will create the databin. Then take the short id and store that to databinid:

 databinid="short id"

Next I will deploy to the cloud a form that will gather the information.

 CloudDeploy[
  FormPage[{{"studentname", "Student Name"} -> 
     "String", {"studentemail", "Student Email"} -> "EmailAddress", 
    "Location" -> "String", {"proctorname", "Proctor Name"} -> 
     "String", {"proctoremail", "Proctor Email"} -> 
     "EmailAddress", {"link", "Proctor Verification"} -> "URL"}, 
   DatabinAdd[
     databinid, <|{"Student Name" -> #studentname, 
       "Student Email" -> #studentemail, "Location" -> #Location, 
       "Proctor Name" -> #proctorname, 
       "Proctor Email" -> #proctoremail, 
       "Proctor Verification" -> Hyperlink@#link}|>] &], 
  "Permissions" -> "Public"]

A URL will be generated that will lead you to the deployed form. Note that you have to be logged into to your wolfram account for this to work.

enter image description here

Once entries are made, you can view the results by using the following code.

 Dataset[Databin@databinid]

Now that the collection process is done, we need to be able to generate emails. In my case I need to generate an email to each proctor with their student's name in the subject line and in the email body. The email will also include a pdf attachment. The first step is to organize the data in a way that can be used by the later command. We use the following.

 dataset = Values[Databin[databinid]]

Next we have a command to generate the body of the message. This could be added directly to the Send Mail command later, but keeping it separate may make if easier to edit later.

 body[student_String] := Style[StringJoin[
    "Hello proctor, 
    Thank you again for being willing to be a proctor for, ", student, 
    " On Friday .......... Thank you \
    "], FontFamily -> "Arial", LineSpacing -> {2, 0}, 
   TextAlignment -> Left]

Now that the body of the message is ready, the following command will send the appropriate email to each proctor.

 length = Length[dataset["Student Name"]]
 Table[SendMail[
   dataset["Proctor Email"][[i]], {dataset["Student Name"][[i]], 
    ToString@body@dataset["Student Name"][[i]]}, 
   "UserName" -> "j*****@***.edu"(*,
   "Password"\[Rule]"*******"*)], {i, 1, length}]

You should also note that for this command to work you need to have Mathematica set up to send emails. To do this go to:

 Edit>>Preferences>>Internet Connectivity>>Mail Settings

Then add the information from your email client.

POSTED BY: Jason Gregersen
2 Replies

enter image description here - you earned "Featured Contributor" badge, congratulations !

This is a great post and it has been selected for the curated Staff Picks group. Your profile is now distinguished by a "Featured Contributor" badge and displayed on the "Featured Contributor" board.

POSTED BY: Moderation Team

Hi Jason,

Thank you for this entry. It's really cool and useful. Regards,

Maria

POSTED BY: Maria Dimitrova
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract