Commit 23e50b59 by juan

Mejora envio con copia a mail

1 parent e358019c
...@@ -33,6 +33,9 @@ class ValidacionCorreo(): ...@@ -33,6 +33,9 @@ class ValidacionCorreo():
Correo = Correo.replace(" ","") Correo = Correo.replace(" ","")
Correo = Correo.replace("\t","") Correo = Correo.replace("\t","")
Correo = Correo.replace("\n","") Correo = Correo.replace("\n","")
Correo = Correo.replace(";",",")
if len(Correo.split(",")) > 1:
return(Correo)
if self.validarcorreo(Correo) == False: if self.validarcorreo(Correo) == False:
Correo = False Correo = False
return(Correo) return(Correo)
......
...@@ -128,6 +128,7 @@ class Mail(ServiceBase): ...@@ -128,6 +128,7 @@ class Mail(ServiceBase):
host = info["smtp"]["host"] host = info["smtp"]["host"]
except: except:
host = False host = False
#Aca inserto deteccion de multiples objetivos
if host == "MAILMASIVO": if host == "MAILMASIVO":
res = self.sendGrid(info, data) res = self.sendGrid(info, data)
return(res) return(res)
...@@ -141,8 +142,11 @@ class Mail(ServiceBase): ...@@ -141,8 +142,11 @@ class Mail(ServiceBase):
msg = MIMEMultipart() msg = MIMEMultipart()
Cr = ValidacionCorreo() Cr = ValidacionCorreo()
msg['From'] = self.Usuario(info) msg['From'] = self.Usuario(info)
msg['To'] = Cr.ValidarCorreo(data[Table.dest]) destino = data[Table.dest]
#print(destino)
msg['Subject'] = info['subject'] msg['Subject'] = info['subject']
msg["To"] = Cr.ValidarCorreo(destino)
print("destino",msg["To"])
succ = {} succ = {}
if msg['To'] == False: if msg['To'] == False:
print("mail no sale") print("mail no sale")
...@@ -156,7 +160,12 @@ class Mail(ServiceBase): ...@@ -156,7 +160,12 @@ class Mail(ServiceBase):
succ[file] = True succ[file] = True
try: try:
if not msg['From'] in stadomail.MailRompedor: if not msg['From'] in stadomail.MailRompedor:
#Multienvio
#for destino in msg['To'].split(","):
# Msg = msg.copy()
# Msg["To"] = Cr.ValidarCorreo(destino)
self.Envio(msg,info,stadomail) self.Envio(msg,info,stadomail)
#self.Envio(msg,info,stadomail)
else: else:
succ[file] = False succ[file] = False
except Exception as E: except Exception as E:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!