diff --git a/scipost/forms.py b/scipost/forms.py index 66f64f20cddcdd6b4fa9346dd726e2897c73e295..21585bae2b99fa5b134c440574ab40d03839979f 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -198,6 +198,11 @@ class SendPrecookedEmailForm(forms.Form): include_scipost_summary = forms.BooleanField( required=False, initial=False, label='Include SciPost summary at end of message') + from_address = forms.ChoiceField(choices=SCIPOST_FROM_ADDRESSES) + + # def __init__(self, *args, **kwards): + # super(SendPrecookedEmailForm, self).__init__(*args, **kwargs) + # self.fields['from_address'].widget.attrs.update( class CreateListForm(forms.ModelForm): diff --git a/scipost/models.py b/scipost/models.py index dc487a81da3f8197b5d24a98533cf8208963b169..93c603dbf7ec0071a00fcb8b7775be35369f9264 100644 --- a/scipost/models.py +++ b/scipost/models.py @@ -499,6 +499,11 @@ class AuthorshipClaim(models.Model): # email = models.EmailField() +SCIPOST_FROM_ADDRESSES = ( + ('J.-S. Caux', 'J.-S. Caux <jscaux@scipost.org>'), + ('Admin', 'SciPost Admin <admin@scipost.org>'), +) + class PrecookedEmail(models.Model): """ Each instance contains an email template in both plain and html formats. diff --git a/scipost/views.py b/scipost/views.py index 73db3faca55e89eb649f21e84476db9bb2f32b0a..c64051e34411fde4a0cd09f92e678c6bd38d3f31 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -1128,7 +1128,8 @@ def send_precooked_email(request): html_version = html_template.render(email_context) message = EmailMultiAlternatives( precookedEmail.email_subject, - email_text, 'SciPost Admin <admin@scipost.org>', + #email_text, 'SciPost Admin <admin@scipost.org>', + email_text, form.cleaned_data['from_address'], [form.cleaned_data['email_address']], bcc=['admin@scipost.org']) message.attach_alternative(html_version, 'text/html')