def email(message_type, plaintext_body, reply_to, sender_address,
    sender_name, subject, html_body=None, variable_defaults=None):
    """
    Required platform override when email in ua.device_types.
    Specifies content of the email being sent. All other notification
    fields are not used in the email if included.

    See https://docs.urbanairship.com/api/ua/#schemas%2femailoverrideobject
        for additional caveats.

    :param message_type: Required. One of transactional or commercial.
    :param plaintext_body: Required. The plain text body of the email. May include
        variable substitution fields for use with create and send inline templates.
    :param reply_to: Required. The reply-to address.
    :param sender_address: Required. The email address of the sender.
        The domain of the email must be enabled in the email
        provider at the delivery tier.
    :param sender_name: Required. The common name of the email sender.
    :param subject: Required. The subject line of the email. May include variable
        substitution fields for use with create and send inline templates.
    :param html_body: Optional. The HTML content of the email.
    :param variable_details: Required for CreateAndSendPush with inline templates.
        a list of dicts of default values for inline template variables.
    """
    if message_type not in ('transactional', 'commercial'):
        raise ValueError(
            'message_type must be either transactional or commercial')
    payload = {}
    payload['message_type'] = message_type
    payload['reply_to'] = reply_to
    payload['sender_address'] = sender_address
    payload['sender_name'] = sender_name
    alert_payload = {'subject': subject, 'plaintext_body': plaintext_body}
    if html_body is not None:
        alert_payload['html_body'] = html_body
    if variable_defaults is not None:
        payload['template'] = {'variable_defaults': variable_defaults,
            'fields': alert_payload}
    else:
        payload.update(alert_payload)
    return payload
