As soon as one of the headers is not a string literal, but rather a variable coming from the outside of your program, it's much harder to correctly deal with it - you have to strip newlines and maybe quotes, escape non-ASCII-characters and so on.

Which is why I recommend to look at Yes, even you can use CPAN and see if you really can't use a module. MIME::Lite appears to be a pure-Perl module, and thus you should be able to use it everywhere where you can put scripts by yourself.