pb de connection au serveur smtp
darcs-hash:20060111190344-4ec08-a689853635fc526caa649d3c64408191cbdc1af4.gz
This commit is contained in:
parent
86a6aade01
commit
6f4450f312
1 changed files with 11 additions and 3 deletions
|
@ -26,6 +26,7 @@ from ldap_crans import crans_ldap, crans, invite, base_classes_crans
|
|||
from time import *
|
||||
import locale
|
||||
locale.setlocale(locale.LC_TIME,'fr_FR')
|
||||
import lock
|
||||
|
||||
# Quelques fonctions
|
||||
####################
|
||||
|
@ -54,8 +55,15 @@ pgsql = PgSQL.connect(host='/var/run/postgresql', database='filtrage', user='cra
|
|||
pgsql.autocommit = True
|
||||
curseur = pgsql.cursor()
|
||||
|
||||
# smtp
|
||||
mail = smtplib.SMTP('localhost')
|
||||
# smtp, assez capricieux
|
||||
for i in range(4):
|
||||
try:
|
||||
mail = smtplib.SMTP('localhost')
|
||||
except:
|
||||
sleep(5)
|
||||
if i==4:
|
||||
print "Impossible de se connecter au SMTP"
|
||||
sys.exit(1)
|
||||
|
||||
# ldap
|
||||
ldap = crans_ldap()
|
||||
|
@ -443,7 +451,7 @@ for ip, id_p2p, nombre in fraudeurs :
|
|||
|
||||
# On envoie un mail a l'adhérent
|
||||
################################
|
||||
corps = p2p.avertissement % {'From':upload.expediteur, 'To':proprio.email(), 'protocole': protocole, 'hostname':hostname}
|
||||
corps = p2p.deconnection % {'From':upload.expediteur, 'To':proprio.email(), 'protocole': protocole, 'hostname':hostname}
|
||||
corps = corps.encode('iso 8859-15')
|
||||
mail.sendmail(upload.expediteur,proprio.email(),corps)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue