-
Notifications
You must be signed in to change notification settings - Fork 0
Automated emails functionality #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think a few adjustments and I can merge this into the other branch.
examples/email_body.html
Outdated
<!DOCTYPE html> | ||
<html> | ||
<style> | ||
</style> | ||
<p>Hello!</p> | ||
<p>If you're reading this, our records show that you have an unexcused absence for our most recent class! If you think this is a mistake, no worries, please reply to this email and we'll sort it out together.</p> | ||
<p>If you did miss class, please reply so we can work together to get you back on track. Whether you're seeking help with course material or navigating personal challenges, we're here to support your success!<p> | ||
<p>Best,</p> | ||
<p>98008 Staff 🦀</p> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use the email builder instead to build these emails? We should aim to be telling people how many times they have been absent, for example if they are at 2 absences then that should be a different message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I previously used lettre, but the emails weren't sending, so I switched back to raw SMTP.
I can integrate lettre with enough plumbing, but I don't have bandwidth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I introduced an email mode. Now we can send different templates with custom filtering functions based on the desired mode
See PR description for usage
src/main.rs
Outdated
/// The minimum number of absences to trigger an email | ||
min_absences: i32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should want to email absentees for a specific week (not every person who has been absent after week 4), so this should be under the week args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I introduced an email mode. Now we can send different templates with custom filtering functions based on the desired mode
See PR description for usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Usage:
attendance email-absentees <MODE> <WEEK>
Single Week Mode:
Cumulative Mode:
To add a new email template, create a section
[templates.name_of_template]
inconfig.toml
:Then implement its respective filter function for
email_absentees_generic
.To test:
config.toml
with your gmail.env
file...you should see that the email has been sent. If you'd like to see how it looks on the sender's end, edit
./examples/roster.csv
to use your test email addresses.Any response other than
y
should cancel the operation.Some other changes:
.env
to gitignore and replaced with.env.example
roster.csv
intoconfig.toml