def new_message(body="", headdict=None, msgclass=SimpleMessage):
    """Factory function that returns a new message object (SimpleMessage by
default). """
    msg = msgclass(body)
    myemail, longname = self_address()
    msg.set_unixfrom("From %s %s" % (myemail, formatdate()))
    if headdict:
        for name, val in headdict.items():
            msg.add_header(name, val)
    return msg
dataset/ETHPy150Open kdart/pycopia/core/pycopia/ezmail.py/new_message/original