Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-11-16 13:20:27 +01:00
commit 6db8d30c3a

View File

@ -61,12 +61,12 @@ class SupportMailbox(POP3Mailbox):
thread_list = mail.get_thread_id() thread_list = mail.get_thread_id()
email_id = mail.mail['From'] email_id = mail.mail['From']
if "<" in mail.mail['From']: if "<" in mail.mail['From']:
import re import re
re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From']) re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
if re_result and re_result[0]: email_id = re_result[0] if re_result and re_result[0]:
email_id = re_result[0]
from webnotes.utils import decode_email_header from webnotes.utils import decode_email_header
@ -119,13 +119,12 @@ class SupportMailbox(POP3Mailbox):
# send auto reply # send auto reply
if cint(self.email_settings.send_autoreply): if cint(self.email_settings.send_autoreply):
if "MAILER-DAEMON" not in d.raised_by: if "mailer-daemon" not in d.raised_by.lower():
self.send_auto_reply(d) self.send_auto_reply(d)
# extract attachments # extract attachments
self.save_attachments(d, mail.attachments) self.save_attachments(d, mail.attachments)
def save_attachments(self, doc, attachment_list=[]): def save_attachments(self, doc, attachment_list=[]):
""" """
Saves attachments from email Saves attachments from email
@ -142,12 +141,12 @@ class SupportMailbox(POP3Mailbox):
+ "\nCould not attach: " + cstr(attachment['filename']) + "\nCould not attach: " + cstr(attachment['filename'])
doc.save() doc.save()
def send_auto_reply(self, d): def send_auto_reply(self, d):
""" """
Send auto reply to emails Send auto reply to emails
""" """
from webnotes.utils import cstr from webnotes.utils import cstr
signature = self.email_settings.fields.get('support_signature') or '' signature = self.email_settings.fields.get('support_signature') or ''
response = self.email_settings.fields.get('support_autoreply') or (""" response = self.email_settings.fields.get('support_autoreply') or ("""
@ -155,10 +154,14 @@ A new Ticket has been raised for your query. If you have any additional informat
reply back to this mail. reply back to this mail.
We will get back to you as soon as possible We will get back to you as soon as possible
----------------------
[This is an automatic response] [This is an automatic response]
""" + cstr(signature)) """ + cstr(signature)) + """
----------------------
Original Query:
""" + d.description
from webnotes.utils.email_lib import sendmail from webnotes.utils.email_lib import sendmail