Private
Public Access
1
0

added data download button on user settings

This commit is contained in:
Sander Roosendaal
2018-03-05 12:51:07 +01:00
parent c1ad98e885
commit ea78242949
7 changed files with 223 additions and 1 deletions

View File

@@ -499,6 +499,37 @@ def handle_zip_file(emailfrom, subject, file,**kwargs):
# Send email with CSV attachment
@app.task
def handle_sendemailsummary(first_name, last_name, email, csvfile, **kwargs):
# send email with attachment
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
subject = "File from Rowsandall.com"
message = "Dear " + first_name + ",\n\n"
message += "Please find attached the requested summary file.\n\n"
message += "Best Regards, the Rowsandall Team"
email = EmailMessage(subject, message,
'Rowsandall <info@rowsandall.com>',
[fullemail])
if os.path.isfile(csvfile):
email.attach_file(csvfile)
else:
csvfile2 = csvfile
with gzip.open(csvfile + '.gz', 'rb') as f_in, open(csvfile2, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
email.attach_file(csvfile2)
os.remove(csvfile2)
res = email.send()
try:
os.remove(csvfile)
except:
pass
return 1
@app.task
def handle_sendemailcsv(first_name, last_name, email, csvfile,**kwargs):