Difference between revisions of "Automated user emails"

From Earlham CS Department
Jump to navigation Jump to search
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
'''Name of Task:''' Automated user emails
 
'''Name of Task:''' Automated user emails
  
'''People Involved:'''  
+
'''People Involved:''' Yuqian Zhang
  
 
'''Date Started:'''  
 
'''Date Started:'''  
Line 7: Line 7:
 
'''Deadline:'''  
 
'''Deadline:'''  
  
'''Description:'''  
+
'''Description:''' Script to email all users.
  
'''Status'''
+
'''Status:''' Finished.
  
 
'''Date Last Updated:'''
 
'''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.
  
[[Category:Open Tasks]]
+
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
 +
 
 +
 
 +
[[Category:Closed Tasks]]

Latest revision as of 13:10, 20 October 2018

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