cleanup message from signature or previous mails (#11124)

This commit is contained in:
Serghei Mihai 2016-06-03 11:27:00 +02:00
parent 5e6d87a1c2
commit 8cac154d21
1 changed files with 11 additions and 1 deletions

View File

@ -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