|
@@ -6,6 +6,10 @@ import sys
|
|
|
from email.mime.multipart import MIMEMultipart
|
|
from email.mime.multipart import MIMEMultipart
|
|
|
from email.mime.text import MIMEText
|
|
from email.mime.text import MIMEText
|
|
|
|
|
|
|
|
|
|
+DB = "EBA_STOCK"
|
|
|
|
|
+USER = "root"
|
|
|
|
|
+PASSWORD = "howdoiturnthison"
|
|
|
|
|
+
|
|
|
|
|
|
|
|
def sendmail(target, message, subject):
|
|
def sendmail(target, message, subject):
|
|
|
noreply = 'consultas@especificosba.com.ar'
|
|
noreply = 'consultas@especificosba.com.ar'
|
|
@@ -41,31 +45,24 @@ def populate(tpl, data):
|
|
|
|
|
|
|
|
return out
|
|
return out
|
|
|
|
|
|
|
|
-_id = 1
|
|
|
|
|
-_id = 163
|
|
|
|
|
-
|
|
|
|
|
-DB = "EBA_STOCK"
|
|
|
|
|
-USER = "root"
|
|
|
|
|
-PASSWORD = "howdoiturnthison"
|
|
|
|
|
-
|
|
|
|
|
-conn = pymysql.connect(unix_socket='/var/run/mysqld/mysqld.sock', user=USER, passwd=PASSWORD, db=DB,cursorclass=pymysql.cursors.DictCursor)
|
|
|
|
|
-# print("pls no")
|
|
|
|
|
-# sys.exit(1)
|
|
|
|
|
-cur = conn.cursor()
|
|
|
|
|
-# cur.execute("SELECT nombre,apellido,mail,hash FROM clientes where id=%s and mail like '%%@%%'", (_id,))
|
|
|
|
|
-# cur.execute("SELECT nombre,apellido,mail,hash FROM clientes where tipo=1 and mail like '%%@%%'")
|
|
|
|
|
-cur.execute("SELECT nombre,apellido,mail,hash FROM clientes where tipo=1 and mail like '%%pouso%%'")
|
|
|
|
|
-clientes = cur.fetchall()
|
|
|
|
|
-for cliente in clientes:
|
|
|
|
|
- print(cliente)
|
|
|
|
|
- DATA = { }
|
|
|
|
|
- DATA["HASH"] = cliente["hash"]
|
|
|
|
|
- target = cliente["mail"]
|
|
|
|
|
- #target = "mpetrigliano@leticiapepe.com.ar"
|
|
|
|
|
- message = open("mailtemplate.html").read()
|
|
|
|
|
- subject = "Link pedidos ESPECIFICOS Buenos Aires"
|
|
|
|
|
- # print(populate(message, DATA))
|
|
|
|
|
- sendmail(target, populate(message, DATA), subject)
|
|
|
|
|
- # sendmail("davidventura27@gmail.com", populate(message, DATA), subject)
|
|
|
|
|
- # sendmail("especificosba@gmail.com", populate(message, DATA), subject)
|
|
|
|
|
|
|
+def reset(identity):
|
|
|
|
|
+ conn = pymysql.connect(unix_socket='/var/run/mysqld/mysqld.sock', user=USER, passwd=PASSWORD, db=DB,cursorclass=pymysql.cursors.DictCursor)
|
|
|
|
|
+ cur = conn.cursor()
|
|
|
|
|
+ if '@' in identity:
|
|
|
|
|
+ cur.execute("SELECT nombre,apellido,mail,hash FROM clientes where tipo=1 and mail = %s", identity)
|
|
|
|
|
+ else: # hash
|
|
|
|
|
+ cur.execute("SELECT nombre,apellido,mail,hash FROM clientes where tipo=1 and hash = %s", identity)
|
|
|
|
|
+ clientes = cur.fetchall()
|
|
|
|
|
+ for cliente in clientes:
|
|
|
|
|
+ DATA = { }
|
|
|
|
|
+ DATA["HASH"] = cliente["hash"]
|
|
|
|
|
+ target = cliente["mail"]
|
|
|
|
|
+ message = open("/var/www/pedido/back/mailtemplate.html").read()
|
|
|
|
|
+ subject = "Link pedidos ESPECIFICOS Buenos Aires"
|
|
|
|
|
+ sendmail(target, populate(message, DATA), subject)
|
|
|
|
|
|
|
|
|
|
+if __name__ == '__main__':
|
|
|
|
|
+ if len(sys.argv) != 2:
|
|
|
|
|
+ print('usage %s mail' % sys.argv[0])
|
|
|
|
|
+ sys.exit(1)
|
|
|
|
|
+ reset(sys.argv[1])
|