I need to change the subject of the emails on a low level. What rails does is encoding the subject as quoted in whatever encoding is set. What I need is to make it quoted but split into chunks of 64 byte, as hotmail doesn't really goes with the standards :/
How do I tell rails to take the subject as is?
I had a look at this as a follow up to my answer to the previous question. The problem lies with TMail. It automatically removes and carriage returns from the subject. I created the following monkey patch as it seems to be the only solution to stop TMail's behaviour.
module TMail
class SubjectHeaderField < UnstructuredHeader
def parse
#Do nothing
end
end
class HeaderField
FNAME_TO_CLASS = FNAME_TO_CLASS.merge('subject' => SubjectHeaderField)
end
end
If you include it in the mailer in Rails 2.3.x it should work. Alternatively you might want to look at http://github.com/mikel/mail/ which is the default mailer in Rails 3?
Then you can set the header before encoding as the previous answer showed.