(self, unixfrom=False, policy=None)
return fp.getvalue()
Return the entire formatted message as a bytes object.

        Optional 'unixfrom', when true, means include the Unix From_ envelope
        header.  'policy' is passed to the BytesGenerator instance used to
        serialize the message; if not specified the policy associated with
        the message instance is used.
Return the entire formatted message as a bytes object.
Return the entire formatted message as a bytes object .
def as_bytes(self, unixfrom=False, policy=None):
        """Return the entire formatted message as a bytes object.

        Optional 'unixfrom', when true, means include the Unix From_ envelope
        header.  'policy' is passed to the BytesGenerator instance used to
        serialize the message; if not specified the policy associated with
        the message instance is used.
        """
        from email.generator import BytesGenerator
        policy = self.policy if policy is None else policy
        fp = BytesIO()
        g = BytesGenerator(fp, mangle_from_=False, policy=policy)
        g.flatten(self, unixfrom=unixfrom)
        return fp.getvalue()
def as_bytes ( self , unixfrom = False , policy = None ) : from email . generator import BytesGenerator policy = self . policy if policy is None else policy fp = BytesIO ( ) g = BytesGenerator ( fp , mangle_from_ = False , policy = policy ) g . flatten ( self , unixfrom = unixfrom ) return fp . getvalue ( )