hdknr / annotated-django

Django for Study
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

emal: django.core.mail.message.BadHeaderError: Header values can't contain newlines #50

Closed hdknr closed 6 years ago

hdknr commented 6 years ago
hdknr commented 6 years ago
    def from_header(self):
        label, address = self.sender.split(' ')
        label = Header(label).encode('ISO-2022-JP')
        label = label.replace('\n', '')                  # newline を除く
        return f"{label} <{address}>"