Skip to content

Commit

Permalink
Merge pull request #2439 from certtools/bugfix-2437
Browse files Browse the repository at this point in the history
Fix smtp_batch bcc #2437
  • Loading branch information
sebix authored Dec 18, 2023
2 parents 3aebcce + be25ed2 commit 571f5c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
- Minor fixes/improvements and some refactoring (see also above: *Core*...).
- `intelmq.bots.outputs.stomp.output` (PR#2423 by Kamil Mankowski):
- Try to reconnect on `NotConnectedException`.
- `intelmq.bots.outputs.smtp_batch.output` (PR #2439 by Edvard Rejthar):
- Fix ability to send with the default `bcc`

### Documentation
- Add a readthedocs configuration file to fix the build fail (PR#2403 by Sebastian Wagner).
Expand Down
7 changes: 3 additions & 4 deletions intelmq/bots/outputs/smtp_batch/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,8 @@ def prepare_mails(self):
lines.extend(json.loads(str(message, encoding="utf-8")) for message in messages)

# prepare rows for csv attachment
threshold = datetime.datetime.now() - datetime.timedelta(
days=self.ignore_older_than_days) if getattr(self, 'ignore_older_than_days',
False) else False
threshold = self.ignore_older_than_days and \
datetime.datetime.now() - datetime.timedelta(days=self.ignore_older_than_days)

# TODO: worthy to generate on the fly https://github.com/certtools/intelmq/pull/2253#discussion_r1172779620
fieldnames = set()
Expand Down Expand Up @@ -338,7 +337,7 @@ def build_mail(self, mail, send=False, override_to=None):
return (Envelope(text)
.attach(path=mail.path, name=attachment_name + '.zip')
.from_(email_from).to(email_to)
.bcc([] if intended_to else getattr(self, 'bcc', []))
.bcc(not intended_to and self.bcc or [])
.subject(subject)
.smtp(self.smtp_server)
.signature(self.gpg_key, self.gpg_pass)
Expand Down

0 comments on commit 571f5c8

Please sign in to comment.