def process_email(email_string): """ main entry point of the module, handles whole processing of the email """ # See if we can parse the email: try: e = elmsubmit_EZEmail.ParseMessage(email_string) except elmsubmit_EZEmail.EZEmailParseError, err: try: if err.basic_email_info['from'] is None: raise ValueError response = elmsubmit_EZEmail.CreateMessage( to=err.basic_email_info['from'], _from=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], message=elmsubmit_config.CFG_ELMSUBMIT_NOLANGMSGS['bad_email'], subject="Re: " + (err.basic_email_info.get('Subject', '') or ''), references=[err.basic_email_info.get('message-id', '') or ''], wrap_message=False) _send_smtp(_from=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], to=err.basic_email_info['from'], msg=response) raise elmsubmitError( "Email could not be parsed. Reported to sender.") except ValueError: raise elmsubmitError( "From: field of submission email could not be parsed. Could not report to sender." )
def _notify_admin(response): response = elmsubmit_EZEmail.CreateMessage( to=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], _from=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], message=response, subject="%s / elmsubmit problem." % CFG_SITE_NAME, wrap_message=False) _send_smtp(_from=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], to=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], msg=response)
def _notify(msg, response): response = elmsubmit_EZEmail.CreateMessage( to=[(msg.from_name, msg.from_email)], _from=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], message=response, subject="Re: " + msg.subject, references=[msg.message_id], wrap_message=False) _send_smtp(_from=elmsubmit_config.CFG_ELMSUBMIT_PEOPLE['admin'], to=msg.from_email, msg=response)