This is a rust code to send each student's grade privately using
lettre
to send emails from rust and csv
to deal with CSV file
of grades and students' names.
As you can see in you should have a sheet like this (if your column names are different feel free to change them in code):
id = "شماره دانشجویی"
name = "نام"
email = "ایمیل"
grade = 100
mistake = "توضیØات"
<html>
<body dir="rtl">
<p>
با سلام<br />
دانشجوی عزیز {{ name }}<br />
نمره تمرین شما
</p>
</body>
</html>
This is a tera template, and you have variables that is set for each student.
Please note that you can check the emails before actually sending them with --dry-run
flag.
Enter your SMTP config and subject in config file.
smtp:
server: smtp.gmail.com
username: [email protected]
password: secret
email:
subject: test
Note that if you use Gmail you must go to your Google account and change Less secure app access here by turning on Allow less secure apps. Otherwise, you need to use application-specific passwords.
You just need to install rust using rustup.
cp conf.yml.example conf.yml
cargo run -- -c ./conf.yml -f ./results.csv