added data download button on user settings
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user