Reputation: 2347
I am trying to add a "reply to" email while using django's EmailMultiAlternatives format.
The documentation demonstrates who to do it with EmailMessage class but doesn't show how to do it when using EmailMultiAlternatives. https://docs.djangoproject.com/en/dev/topics/email/?from=olddocs#sending-alternative-content-types
Thanks for the feedback.
Upvotes: 3
Views: 2816
Reputation: 31949
If you also want to supply a name and email John Doe <[email protected]>
email = AnymailMessage(reply_to=["John Doe <[email protected]>"])
email = AnymailMessage(
reply_to=["{} <{}>".format(
serializer.validated_data["name"],
serializer.validated_data["email"])])
Upvotes: 1
Reputation: 10811
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': "[email protected]"})
UPDATE 01/01/2015
As of Django 1.8, you can do it as follows:
msg = EmailMultiAlternatives(reply_to=["[email protected]"])
Upvotes: 12