Automated user emails

From Earlham CS Department
Revision as of 13:10, 20 October 2018 by Yuzhang16 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Name of Task: Automated user emails

People Involved: Yuqian Zhang

Date Started:

Deadline:

Description: Script to email all users.

Status: Finished.

Date Last Updated:

This is script we will use to email all users on a particular domain for, e.g., maintenance and planned downtime. The script is available in two places: on hopper called "email-users-latest-version.py", and in "user-alert-emails project in Gitlab. This script has new functions that you can send emails to certain users, e.g. only cluster users, users who have logged in within 3 months. And all replies will automatically forward to admin@cs.earlham.edu.

1. Notes for Making Changes:

(1) Send to users who logged in within a certain time: Change the 'lastlog' command. 'lastlog -t' is in DAYS. E.g., 'lastlog -t 180' send emails to users who logged in in the past 180 days.

(2) Send to CS AND/OR Cluster users: If send to ONLY cluster users, simply delete or '#' the same three lines of code 'email_list.append(info[0] + '@cs.earlham.edu')' inside the 'for loop'.

(3) Change email subject: In the second method 'send_mail', change 'msg['Subject'] = 'Your Subject Name'.

(4) Change Reply-To address: Also in the second method 'send_mail', change the 'reply_to_address = '.

2.If you want to test this script without actually sending out emails to all users:

The key is the last command 'return email_list' in the first method 'get_users'. You can rewrite it to 'return' to your own email address. Also don't forget to rewrite the 'reply-to-address' in 'send_mail' if you don't want others to receive the reply.

-Yuqian Zhang 10/20/2018