[Django]-Add reply to address to django EmailMultiAlternatives

12👍

To add Reply-To in EmailMultiAlternatives you have to do it in the same way you do so with EmailMessage.

As you can see in django’s source code EmailMultiAlternatives inherits from EmailMessage so they take the same parameters in the init constructor.

So to add Reply-To:

msg = EmailMultiAlternatives(headers={'Reply-To': "another@example.com"})

UPDATE 01/01/2015

As of Django 1.8, you can do it as follows:

msg = EmailMultiAlternatives(reply_to=["another@example.com"])

1👍

If you also want to supply a name and email John Doe <john.doe@example.com>

email = AnymailMessage(reply_to=["John Doe <john.doe@example.com>"])
email = AnymailMessage(
    reply_to=["{} <{}>".format(
        serializer.validated_data["name"], 
        serializer.validated_data["email"])])
👤Qwerty

Leave a comment