add message and conflicts to mail to office
This commit is contained in:
parent
9c85cf066c
commit
32bc459bb1
@ -188,7 +188,7 @@ class Participation(object):
|
||||
str += "Registration date: %s\n" % self.registration_date.isoformat()
|
||||
str += "Message:%s\n" % self._message
|
||||
if not self.valid:
|
||||
str += "Inconsistencies: %s\n" % ", ".join(self._conflicts)
|
||||
str += "Inconsistencies: %s\n" % self.inconsistencies
|
||||
return str
|
||||
|
||||
|
||||
@ -258,7 +258,8 @@ def send_confirmation(p=None, csv_file=None):
|
||||
msg.set_content(content)
|
||||
msg['Subject'] = 'Etho 2020 registration confirmation'
|
||||
msg['From'] = EMAIL_ADDRESS
|
||||
msg['To'] = p._email
|
||||
msg['To'] = p._email if p else EMAIL_ADDRESS
|
||||
msg['Cc'] = EMAIL_ADDRESS
|
||||
msg['Reply-to'] = EMAIL_REPLY
|
||||
|
||||
s = smtplib.SMTP(SMTP_SERVER)
|
||||
@ -270,8 +271,15 @@ 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 # FIXME this is wrong!!! needs to be EMAIL_REPLy
|
||||
|
||||
csv_msg['To'] = p._email # FIXME this is wrong!!! needs to be EMAIL_REPLY
|
||||
content = ""
|
||||
if p and not p.valid:
|
||||
content += "Registration contains inconsistencies!\n"
|
||||
content += p.inconsistencies
|
||||
content += "\n"
|
||||
if p and len(p.message) > 0:
|
||||
content += "Participant left a message:\n %s \n\n" % p.message
|
||||
csv_msg.set_content(content)
|
||||
with open(csv_file, 'rb') as fp:
|
||||
file_data = fp.read()
|
||||
csv_msg.add_attachment(file_data, maintype='text', subtype="comma-separated-values",
|
||||
|
Loading…
Reference in New Issue
Block a user