from anymail.signals import pre_send
from django.dispatch import receiver


@receiver(pre_send)
def remove_message_id(sender, message, **kwargs):
    # We need to remove the already generated Message-ID and let it be generated by the
    # ESP in order to avoid the message being identified as spam by some strict
    # filters.
    message.extra_headers.pop("Message-ID", None)
