Sendmail plugin: Allow to attach a file to emails (#1814)

* sendmail: allow to attach files to emails

* Fix mixup of model objects and model IDs

* Attach to order-level emails, not only position-level emails

* Give attachments a proper file type

* Add a warning note about higher spam chances

Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
This commit is contained in:
Sohalt
2020-10-22 09:53:19 +02:00
committed by GitHub
parent d673a43130
commit 9e4dc344a4
5 changed files with 51 additions and 18 deletions

View File

@@ -231,7 +231,7 @@ def mail(email: Union[str, Sequence[str]], subject: str, template: Union[str, La
attach_tickets=attach_tickets,
attach_ical=attach_ical,
user=user.pk if user else None,
attach_cached_files=[cf.id for cf in attach_cached_files] if attach_cached_files else [],
attach_cached_files=[(cf.id if isinstance(cf, CachedFile) else cf) for cf in attach_cached_files] if attach_cached_files else [],
)
if invoices: