--- generator.py 2016-03-31 04:49:03.000000000 -0700 +++ /home/mark/generator.py 2016-06-14 15:49:27.668328440 -0700 @@ -186,8 +186,11 @@ # If we munged the cte, copy the message again and re-fix the CTE. if munge_cte: msg = deepcopy(msg) - msg.replace_header('content-transfer-encoding', munge_cte[0]) - msg.replace_header('content-type', munge_cte[1]) + del msg['content-transfer-encoding'] + del msg['content-type'] + msg['Content-Transfer-Encoding'] = munge_cte[0] + msg['Content-Type'] = munge_cte[1] + # Write the headers. First we see if the message object wants to # handle that itself. If not, we'll do it generically. meth = getattr(msg, '_write_headers', None)