def validate_incoming(self): """ Checks support ticket email settings """ if self.doc.sync_support_mails and self.doc.support_host: from webnotes.utils.email_lib.receive import POP3Mailbox from webnotes.model.doc import Document import _socket, poplib inc_email = Document('Incoming Email Settings') inc_email.encode() inc_email.host = self.doc.support_host inc_email.use_ssl = self.doc.support_use_ssl try: err_msg = 'User Name or Support Password missing. Please enter and try again.' if not (self.doc.support_username and self.doc.support_password): raise AttributeError, err_msg inc_email.username = self.doc.support_username inc_email.password = self.doc.support_password except AttributeError, e: webnotes.msgprint(err_msg) raise pop_mb = POP3Mailbox(inc_email) try: pop_mb.connect() except _socket.error, e: # Invalid mail server -- due to refusing connection webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.') raise
def __init__(self): """ settings_doc must contain use_ssl, host, username, password """ from webnotes.model.doc import Document # extract email settings self.email_settings = Document('Email Settings','Email Settings') s = Document('Support Email Settings') s.use_ssl = self.email_settings.support_use_ssl s.host = self.email_settings.support_host s.username = self.email_settings.support_username s.password = self.email_settings.support_password POP3Mailbox.__init__(self, s)
def __init__(self): """ settings_doc must contain use_ssl, host, username, password """ from webnotes.model.doc import Document # extract email settings self.email_settings = Document('Email Settings', 'Email Settings') if not self.email_settings.fields.get('sync_support_mails'): return s = Document('Support Email Settings') s.use_ssl = self.email_settings.support_use_ssl s.host = self.email_settings.support_host s.username = self.email_settings.support_username s.password = self.email_settings.support_password POP3Mailbox.__init__(self, s)
def __init__(self): """ settings_doc must contain use_ssl, host, username, password """ from webnotes.model.doc import Document # extract email settings self.email_settings = Document("Email Settings", "Email Settings") if not self.email_settings.fields.get("sync_support_mails"): return s = Document("Support Email Settings") s.use_ssl = self.email_settings.support_use_ssl s.host = self.email_settings.support_host s.username = self.email_settings.support_username s.password = self.email_settings.support_password POP3Mailbox.__init__(self, s)
def __init__(self): """ settings_doc must contain is_ssl, host, username, password """ POP3Mailbox.__init__(self, 'Support Email Settings')