More email stuff.
This commit is contained in:
parent
4def56ad92
commit
cd66b5fd5d
|
@ -3,6 +3,7 @@ from django.contrib import admin
|
||||||
from .models import OutgoingEmail
|
from .models import OutgoingEmail
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(OutgoingEmail)
|
||||||
class OutgoingEmailAdmin(admin.ModelAdmin):
|
class OutgoingEmailAdmin(admin.ModelAdmin):
|
||||||
model = OutgoingEmail
|
model = OutgoingEmail
|
||||||
fields = ['subject', 'to_recipients']
|
fields = ['subject', 'to_recipients']
|
|
@ -71,7 +71,6 @@ def add_outgoing_email(
|
||||||
sender="BornHack <info@bornhack.dk>",
|
sender="BornHack <info@bornhack.dk>",
|
||||||
attachment=None,
|
attachment=None,
|
||||||
attachment_filename="",
|
attachment_filename="",
|
||||||
attachments=None,
|
|
||||||
):
|
):
|
||||||
""" adds an email to the outgoing queue
|
""" adds an email to the outgoing queue
|
||||||
recipients is a list of to recipients
|
recipients is a list of to recipients
|
||||||
|
@ -100,4 +99,9 @@ def add_outgoing_email(
|
||||||
bcc_recipients=bcc_recipients,
|
bcc_recipients=bcc_recipients,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if attachment:
|
||||||
|
django_file = ContentFile(attachment)
|
||||||
|
django_file.name = attachment_filename
|
||||||
|
email.attachment.save(attachment_filename, django_file, save=True)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue