provide BCC to sender, controlled by class variable
This commit is contained in:
parent
b70b522137
commit
11f859b71e
1 changed files with 6 additions and 1 deletions
|
@ -189,6 +189,8 @@ class SendEmailForm(NodeView):
|
|||
|
||||
class SendEmail(FormController):
|
||||
|
||||
bccToSender = False
|
||||
|
||||
def checkPermissions(self):
|
||||
return (not self.isAnonymous and
|
||||
super(SendEmail, self).checkPermissions())
|
||||
|
@ -205,7 +207,10 @@ class SendEmail(FormController):
|
|||
msg = MIMEText(message.encode('utf-8'), 'plain', 'utf-8')
|
||||
msg['Subject'] = subject.encode('utf-8')
|
||||
msg['From'] = sender
|
||||
msg['To'] = ', '.join(r.strip() for r in recipients if r.strip())
|
||||
recipients = [r.strip() for r in recipients if r.strip()]
|
||||
msg['To'] = ', '.join(recipients)
|
||||
if self.bccToSender:
|
||||
recipients.append(sender)
|
||||
mailhost = component.getUtility(IMailDelivery, 'Mail')
|
||||
mailhost.send(sender, recipients, msg.as_string())
|
||||
return True
|
||||
|
|
Loading…
Add table
Reference in a new issue