send_by_email: add another way to get current user email address (#4326)

This commit is contained in:
Frédéric Péters 2014-10-29 14:30:46 +01:00
parent 1e0328bb78
commit 2a813ff5bf
1 changed files with 7 additions and 1 deletions

View File

@ -64,7 +64,13 @@ class MailForm(form.AddForm):
msg = MIMEMultipart()
msg['Subject'] = subject
msg['To'] = ', '.join(recipients)
msg['From'] = api.user.get_current().email or \
ldap_email = api.user.get_current().getProperty('email')
if not isinstance(ldap_email, str):
ldap_email = None
msg['From'] = api.user.get_current().getProperty('email', None) or \
api.user.get_current().email or \
api.portal.get().getProperty('email_from_address') or \
'admin@localhost'