send csv file as attachment
This commit is contained in:
parent
6c4c23703b
commit
cc1594d9c1
@ -169,7 +169,7 @@ class Participation(object):
|
||||
f.write("; ".join(header))
|
||||
f.write("\n")
|
||||
f.write("; ".join(values))
|
||||
|
||||
return filename
|
||||
def __str__(self):
|
||||
str = ""
|
||||
str += "Name: %s %s\n" % (self._first_name, self._last_name)
|
||||
@ -271,13 +271,13 @@ def send_confirmation(p=None, csv_file=None):
|
||||
csv_msg = EmailMessage()
|
||||
csv_msg['Subject'] = 'New Registration ' + p.name if p else ""
|
||||
csv_msg['From'] = EMAIL_ADDRESS
|
||||
csv_msg['To'] = p._email
|
||||
csv_msg['To'] = p._email # FIXME this is wrong!!! needs to be EMAIL_REPLy
|
||||
|
||||
with open(csv_file, 'rb') as fp:
|
||||
file_data = fp.read()
|
||||
csv_msg.add_attachment(file_data, maintype='text',
|
||||
subtype="comma-separated-values")
|
||||
s.send_message(csv_msg)
|
||||
csv_msg.add_attachment(file_data, maintype='text', subtype="comma-separated-values",
|
||||
filename=os.path.basename(csv_file))
|
||||
s.send_message(csv_msg)
|
||||
s.quit()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user