@classmethod
def from_message(cls, recipient, message):
    """create a model instance from a django.core.mail.message.EmailMultiAlternatives instance"""
    instance = cls(recipient=recipient, subject=message.subject, from_email
        =message.from_email)
    if message.content_subtype == 'html':
        missing_alternative = 'plain'
        instance.html_body = message.body
    elif message.content_subtype == 'plain':
        missing_alternative = 'html'
        instance.plain_body = message.body
    else:
        raise ValueError(
            'You must provide either a HTML or a plain body to DBES backend')
    for body, mimetype in getattr(message, 'alternatives', []):
        if mimetype == 'text/{0}'.format(missing_alternative):
            setattr(instance, '{0}_body'.format(missing_alternative), body)
            break
    return instance
