cleanup message from signature or previous mails (#11124)
This commit is contained in:
parent
5e6d87a1c2
commit
8cac154d21
|
@ -51,6 +51,16 @@ def parse_attachment(data):
|
|||
return attachment
|
||||
return None
|
||||
|
||||
def cleanup_message(message):
|
||||
cleanup_marks = ['----- Mail original -----',
|
||||
'-----Message d\'origine-----',
|
||||
'-- ', '--']
|
||||
for mark in cleanup_marks:
|
||||
if mark in message:
|
||||
return message[:message.index(mark)]
|
||||
return message
|
||||
|
||||
|
||||
def send_mail(to, subject, message):
|
||||
s = smtplib.SMTP('localhost')
|
||||
from_mail = 'noreply@entrouvert.com'
|
||||
|
@ -95,7 +105,7 @@ def create_ticket(mail):
|
|||
issue_data = {'project_id': PROJECT_ID,
|
||||
'subject': parse_header(mail['Subject']),
|
||||
'tracker_id': TRACKER_ID,
|
||||
'description': body,
|
||||
'description': cleanup_message(body),
|
||||
'uploads': attachments}
|
||||
if tech_manager:
|
||||
issue_data['assigned_to_id'] = tech_manager.id
|
||||
|
|
Loading…
Reference in New Issue