Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix smtp_batch bcc #2437 #2439

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading