The Club of Programmers, IIT(BHU) organizes it's flagship GSoC Mentorship Program every year.
It is not just another group mentorship program but is a full-fledged close mentorship program. COPS pairs people across all years with alumni and previous GSoC students who will be guiding everyone individually!
While the program stays focused on Google Summer of Code, the mentorship will span all major open-source programs, including
- Outreachy
- LFX Mentorship
Last year in 2021, the program was a massive success, with over 23 selections, including two first-year students. IIT BHU became the institute with the second-highest selections worldwide.
The repository contains code for parsing JSONs related to the mentoship program and then sending mails to the people involved. Two major modules in the repository are:
- Extractor
- Mailer
The module contains details about structs
used to parse down and store information. Also residing inside module are some utility functions that come useful. Data is stored in form of:
- Person/Mentor
- Mentee
- Mentorship
The exported files are usually in CSV
from google sheets. CSV are not easy to parse as encoding/csv returns back an array of string which was a hassle to convert and accessing a single entity as array isn't that intutive as well.
Luckily, I found an online tool csv2json so now all data is in json.
Extractor extracts out the mentors from one json and mentees from another. Puts them together as Mentorships.
The authorization is obtained using email and app password generated by Google for Email App. We use Secure Mail Transport Protocol (SMTP) standard module for sending Mail. Using Plain Auth and SMTP config.
SendMail
Function needs auth, config, sender email, to send emails and body messages.
The body message is normal html with certain headers. The headers are written first in the body message then we head over to template.
html/template is used to Execute the object onto a HTML Template in a bytes.Buffer
which is then converted to Bytes()
and sent as body message.