Mail quand on a des nouveaux droits (pas fini)
darcs-hash:20070930192144-c992d-7622ea4a207ee3175b0d3fe803b495440d95d06c.gz
This commit is contained in:
parent
f872471fe9
commit
68808e40c5
1 changed files with 34 additions and 3 deletions
|
@ -141,9 +141,9 @@ class home:
|
|||
class mail_bienvenue:
|
||||
debug = True
|
||||
|
||||
def __init__(self, mails):
|
||||
self.mails = mails
|
||||
|
||||
def __init__(self, args):
|
||||
self.args = args
|
||||
|
||||
def reconfigure(self):
|
||||
cprint(u'Envoi mail de bienvenue', 'gras')
|
||||
for mail in self.mails:
|
||||
|
@ -162,6 +162,37 @@ class mail_bienvenue:
|
|||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
class mail_ajout_droits:
|
||||
debug = True
|
||||
|
||||
def __init__(self, args):
|
||||
self.args = args
|
||||
|
||||
def reconfigure(self):
|
||||
cprint(u'Envoi mail ajout de droits', 'gras')
|
||||
for arg in self.args:
|
||||
login = arg.split(":")[0]
|
||||
Droit = arg.split(":")[1]
|
||||
anim('\t' + login)
|
||||
try:
|
||||
From = "root@crans.org"
|
||||
To = login
|
||||
if To.find('@') == -1: To += '@crans.org'
|
||||
if Droit in config.pages_infos_droits:
|
||||
print "envoi du mail"
|
||||
Page = config.pages_infos_droits[Droit.encode('utf-8')]
|
||||
conn=smtplib.SMTP('localhost')
|
||||
conn.sendmail(From, To, config.txt_mail_bienvenue % { 'From': From, 'To': To , 'Droit': Droit, 'Page': Page})
|
||||
conn.quit()
|
||||
print OK
|
||||
else:
|
||||
print "ca marche pas"
|
||||
except Exception, c:
|
||||
print ERREUR
|
||||
if self.debug:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
class ML_ens:
|
||||
debug = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue