#!/usr/bin/env python # # reset the waiting list after ZAT. # before running this script, be sure to apply the patchfile generated by the eressea-server to # mark users with new accounts as ACTIVE. # * Will mark WAITING users as EXPIRED, removig them from the waitng list. # * Will mark CONFIRMED users as WAITING, and send them another mail. import MySQLdb import re import sys import smtplib dbname=sys.argv[1] date=sys.argv[2] db=MySQLdb.connect(db=dbname) From='accounts@eressea-pbem.de' cursor=db.cursor() MailTemplate="templates/register.mail" smtpserver='localhost' server=smtplib.SMTP(smtpserver) def Send(email, custid, firstname, password, position, locale): TemplateHandle = open(MailTemplate+"."+locale, "r") # open in read only mode # read the entire file as a string TemplateInput = TemplateHandle.read() TemplateHandle.close() # close the file SubResult = re.subn("", firstname, TemplateInput) SubResult = re.subn("", password, SubResult[0]) SubResult = re.subn("", str(int(position)), SubResult[0]) SubResult = re.subn("", str(int(custid)), SubResult[0]) Msg="From: "+From+"\nTo: "+email+"\nSubject: Eressea Anmeldung\n\n" Msg=Msg+SubResult[0] server.sendmail(From, email, Msg) return cursor.execute("update users set status='EXPIRED' where TO_DAYS(updated)