##// END OF EJS Templates
emails: make bad headers error show what headers we investigated....
marcink -
r1727:25849370 default
parent child Browse files
Show More
@@ -114,14 +114,18 b' class Message(object):'
114
114
115 return response
115 return response
116
116
117 def _get_headers(self):
118 headers = [self.subject, self.sender]
119 headers += list(self.send_to)
120 headers += self.extra_headers.values()
121 return headers
122
117 def is_bad_headers(self):
123 def is_bad_headers(self):
118 """
124 """
119 Checks for bad headers i.e. newlines in subject, sender or recipients.
125 Checks for bad headers i.e. newlines in subject, sender or recipients.
120 """
126 """
121
127
122 headers = [self.subject, self.sender]
128 headers = self._get_headers()
123 headers += list(self.send_to)
124 headers += self.extra_headers.values()
125
129
126 for val in headers:
130 for val in headers:
127 for c in '\r\n':
131 for c in '\r\n':
@@ -144,7 +148,8 b' class Message(object):'
144 raise InvalidMessage("No sender address has been set")
148 raise InvalidMessage("No sender address has been set")
145
149
146 if self.is_bad_headers():
150 if self.is_bad_headers():
147 raise BadHeaders
151 headers = self._get_headers()
152 raise BadHeaders(headers)
148
153
149 def add_recipient(self, recipient):
154 def add_recipient(self, recipient):
150 """
155 """
General Comments 0
You need to be logged in to leave comments. Login now