mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 21:28:32 +00:00
Add name
to email script and email_service
This commit is contained in:
parent
56fe0bb606
commit
b52343903c
@ -63,6 +63,7 @@ email(subject="My Subject", recipients="user@example.com", attachments=['Study_A
|
||||
bcc = []
|
||||
reply_to = None
|
||||
files = None
|
||||
name = None
|
||||
if 'cc' in kwargs and kwargs['cc'] is not None:
|
||||
cc = self.get_email_addresses(kwargs['cc'], study_id)
|
||||
if 'bcc' in kwargs and kwargs['bcc'] is not None:
|
||||
@ -72,6 +73,8 @@ email(subject="My Subject", recipients="user@example.com", attachments=['Study_A
|
||||
# Don't process if attachments is None or ''
|
||||
if 'attachments' in kwargs and kwargs['attachments'] is not None and kwargs['attachments'] != '':
|
||||
files = self.get_files(kwargs['attachments'], study_id)
|
||||
if 'name' in kwargs and kwargs['name'] is not None:
|
||||
name = kwargs['name']
|
||||
|
||||
else:
|
||||
raise ApiError(code="missing_argument",
|
||||
@ -95,7 +98,8 @@ email(subject="My Subject", recipients="user@example.com", attachments=['Study_A
|
||||
study_id=study_id,
|
||||
reply_to=reply_to,
|
||||
attachment_files=files,
|
||||
workflow_spec_id=workflow_spec_id
|
||||
workflow_spec_id=workflow_spec_id,
|
||||
name=name
|
||||
)
|
||||
except Exception as e:
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
|
@ -19,7 +19,7 @@ class EmailService(object):
|
||||
|
||||
@staticmethod
|
||||
def add_email(subject, sender, recipients, content, content_html,
|
||||
cc=None, bcc=None, study_id=None, reply_to=None, attachment_files=None, workflow_spec_id=None):
|
||||
cc=None, bcc=None, study_id=None, reply_to=None, attachment_files=None, workflow_spec_id=None, name=None):
|
||||
"""We will receive all data related to an email and store it"""
|
||||
|
||||
# Find corresponding study - if any
|
||||
@ -30,7 +30,7 @@ class EmailService(object):
|
||||
# Create EmailModel
|
||||
email_model = EmailModel(subject=subject, sender=sender, recipients=str(recipients),
|
||||
content=content, content_html=content_html, study=study,
|
||||
cc=cc, bcc=bcc, workflow_spec_id=workflow_spec_id)
|
||||
cc=cc, bcc=bcc, workflow_spec_id=workflow_spec_id, name=name)
|
||||
|
||||
# Send mail
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user