Add support for emailing documents to a recipient list. GitLab #396
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
21
mayan/apps/mailer/utils.py
Normal file
21
mayan/apps/mailer/utils.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .literals import EMAIL_SEPARATORS
|
||||
|
||||
|
||||
def split_recipient_list(recipients, separator_list=None, separator_index=0):
|
||||
separator_list = separator_list or EMAIL_SEPARATORS
|
||||
|
||||
try:
|
||||
separator = separator_list[separator_index]
|
||||
except IndexError:
|
||||
return recipients
|
||||
else:
|
||||
result = []
|
||||
for recipient in recipients:
|
||||
result.extend(recipient.split(separator))
|
||||
|
||||
return split_recipient_list(
|
||||
recipients=result, separator_list=separator_list,
|
||||
separator_index=separator_index + 1
|
||||
)
|
||||
Reference in New Issue
Block a user