'Sanitize the email sender string to prevent MIME-encoding
of the from-address (RFC2047)
@param: the sender-string
@returns: the sanitized sender-string'

@staticmethod
def sanitize_sender(sender):

    if (not sender):
        return sender
    match = SENDER.match(sender)
    if match:
        (sender_name, from_address) = match.groups()
        if any((((32 > ord(c)) or (ord(c) > 127)) for c in sender_name)):
            from email.header import Header
            sender_name = Header(sender_name.strip(), 'utf-8')
        else:
            sender_name = sender_name.strip()
        sender = ('%s    <%s>' % (sender_name, from_address.strip()))
    return sender
