Dans la série suppression des liens symboliques : /usr/scripts/lib devient /usr/scripts/cranslib

* Comme ça c'est plus clair que c'est un truc custom crans
 * Le lien symbolique /usr/scripts/gestion/crans/ est retiré. D'autres suivront.
This commit is contained in:
Vincent Le Gallic 2013-05-08 04:04:30 +02:00
parent c57795f23b
commit 10275229a1
35 changed files with 20 additions and 29 deletions

25
cranslib/mail/__init__.py Normal file
View file

@ -0,0 +1,25 @@
"""
__init__.py
Fonction de base pour les mails.
Copyright (c) 2006 by www.crans.org
"""
SENDMAIL = "/usr/sbin/sendmail" # sendmail location
def quickSend(From=None, To=None, Subject=None, Text=None, disconnect_on_bounce=0):
"""envoie d'un mail"""
OPTIONS = ' -t' #extract recipient from headers
if disconnect_on_bounce:
OPTIONS+= ' -V -f bounces'
from os import popen
p = popen("%s -t %s" % (SENDMAIL, OPTIONS), "w")
p.write("From: %s\n" % From)
p.write("To: %s\n" % To)
p.write("Subject: %s\n" % Subject)
p.write("\n") # blank line separating headers from body
p.write("%s\n" % Text)
sts = p.close()
if sts:
print "Sendmail exit status", sts