User Tools

Site Tools


admin:dismemberment

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
admin:dismemberment [2020/04/20 14:32] hibbyadmin:dismemberment [2023/03/05 15:24] – [Example email] Wouter
Line 12: Line 12:
 Articles don't specify a timeline for the steps but they do have to happen in that order (and it's good idea to leave a decent interval between reminder and actually dismembering folks so they can respond to the reminder).  Articles don't specify a timeline for the steps but they do have to happen in that order (and it's good idea to leave a decent interval between reminder and actually dismembering folks so they can respond to the reminder). 
  
-==== Example email ====+==== Example email, in Python 3====
  
-Swap out dummy list of people to send to for the list from the hub page of folks behind on dues. +'''This script sends out dismemberment emails, from a csv file with 4 columns:  
-<code> + username, real name, email address,last payment
-#+BEGIN_SRC python +
-# -*- coding: utf-8 -*-+
  
-from email.MIMEText import MIMEText +yagmail is used in combination with gmail for smtp emailing.
-from localSettings import * +
-import smtplib +
-from jinja2 import Environment+
  
-email = """ +'''
-Hello from 57North Hacklab,+
  
-Our records don't show any payments from you since {{ last_payment }}. That is long enough ago that you're on the list of people who can have their membership terminated by the board. We're planning to be going through that list at a board meeting {{ meeting }}. +#importing the Yagmail library 
 +import yagmail 
 +import csv
  
-If you think there should be payment(s) more recently than that: please get in touch (57north-ctte-private@lists.57north.co) with when and how you paid and we can look into why it didn't get recorded. +##gmail username 
 +sender = 'youremailaddress' 
 +##gmail app password  
 +password = 'yourpassword'
  
-We don't like terminating memberships so we haven't since September 2014, this has led to the member list having people on it that we know have moved away, and others that we haven't seen for quite a whileIt really is time we cleaned this up.+## reply to email 
 +reply_email = '57north-ctte-private@57north.org.uk'
  
-If you don't want to keep up your membership please let us know at 57north-ctte-private@lists.57north.co 
  
-If you do want to continue being memberplease payOur preferred mechanism to receive money is via bank transfer (details in hubor below) or you can give cash to a director. If you won't be able to do that before the meetingbut do intend to be back in the near future: get in touch (57north-ctte-private@lists.57north.co), we can possibly be a bit more flexible.+##open csv file and loop through every line, sending emails one at time. 
 +with open('dismemberment.csv') as csv_file: 
 +    csv_reader = csv.reader(csv_filedelimiter=',') 
 +        
  
-If you're a bit behind we don't necessarily expect you to pay all of the back dues to avoid having your membership terminated - though if you want to we'll certainly appreciate the money. We are happy to consider you back in "good standingif you pay for this month and last.+    for row in csv_reader: 
 +        lastpayment = row[3] 
 +        username = row[0] 
 +        address = row[2] 
 +        contents = [ 
 +    """ Hello from 57North Hacklab. 
 +     
 +    Dear """ + username + """,
  
-Thanks, +    Our records don't show any payments from you since """ + lastpayment+ """That is long enough ago that you're on the list of people who can have their membership terminated by the board. We're planning to be going through that list at a board meeting on 5th April 2023.
-The 57North Hacklab Ltdboard of directors.+
  
-Bank transfer details: +    If you think there should be payment(s) more recently than thatplease get in touch (57north-ctte-private@57north.org.uk) with when and how you paid and we can look into why it didn't get recorded
-Account name:           57North Hacklab Ltd. +
-Account number:         11 088 091 +
-Sort code:         83-15-31 +
-Payment reference: {{ username }} +
-Payment:                GBP 20.00 monthly on/soon after the 1st of every month+
  
-57North Hacklab Ltd. is a company registered in Scotland (No. SC470230). +    We don't like terminating memberships so, this has led to the member list having people on it that we know have moved away, and others that we haven't seen for quite a whileIt really is time we cleaned this up.
-57North and 57North Hacklab are trading names of 57North Hacklab Ltd.+
  
-"""+    If you don't want to keep up your membership please let us know at 57north-ctte-private@57north.org.uk
  
-dummy = [{'username':'someone', 'email':'someone@example.com''last_payment':'None'}]+    If you do want to continue being a memberplease consider paying or if you are having temporary cashflow concerns, then please do let us know so we can work something out. Our preferred mechanism to receive money is via bank transfer (details in hackhub, or below) or you can give cash to a director. If you won't be able to do that before the Tuesday's open night meetingbut do intend to be back in the near futureget in touch (57north-ctte-private@57north.org.uk)we can possibly be a bit more flexible.
  
-def send(subject, message, recipient): +    If you're a bit behind we don't necessarily expect you to pay all of the back dues to avoid having your membership terminated though if you want to we'll certainly appreciate the moneyWe are happy to consider you back in "good standingif you pay for this month and last.
-    try: +
-        message = MIMEText(message) +
-        message['Subject'] = subject +
-        message['From'] = addr +
-        message['To'] = recipient +
-        message['Reply-To'] = '57north-ctte-private@lists.57north.co' +
-         +
-        server = smtplib.SMTP(mailserver) +
-        server.starttls() +
-        server.login(user, passwd) +
-        server.sendmail(addr, [recipient, bcc, "57north-ctte-private@lists.57north.co"], +
-                        message.as_string()) +
-        server.close() +
-    except Exception, ex: +
-        print "Failed to send email." +
-        print ex+
  
-if __name__=="__main__": +    Thanks,
-    for person in dummy: +
-        print "Emailing "person['username'+
-        send("57North membership", +
-             Environment().from_string(email).render( +
-                 last_payment=person['last_payment'], username=person['username'], +
-                 meeting="19:30 Thursday 16th March 2017"), +
-             person['email']) +
-#+END_SRC+
  
-</code>+    The 57North Hacklab Ltd. board of directors. 
 + 
 +    Bank transfer details: 
 +    Account name:           57North Hacklab Ltd. 
 +    Account number:         11 088 091 
 +    Sort code:         83-15-31 
 +    Payment reference: """ + username + """ 
 +    Payment:                GBP 20.00 monthly on/soon after the 1st of every month 
 + 
 +    57North Hacklab Ltd. is a company registered in Scotland (No. SC470230). 
 +    57North and 57North Hacklab are trading names of 57North Hacklab Ltd. 
 + 
 +    """ 
 +
 +        ##initializing the server connection 
 +        yag = yagmail.SMTP(user=sender, password=password) 
 +        ##sending the email 
 +        yag.send(to=address,subject='Hello from 57North Hacklab',bcc='57north-ctte-private@57north.org.uk', contents =contents, headers={"Reply-To":f"{reply_email}"}) 
 +        
  
 ===== Other Reasons ===== ===== Other Reasons =====
admin/dismemberment.txt · Last modified: 2023/03/05 15:25 by Wouter