"so really need a way to identify the format and use plain or html accordingly."
If you're sending it, you should know what the content is. So, no, you don't "really need" some external evaluation of the file type... unless you're being paid to send spam without reviewing the content :-)
That said, you might also consider a file test construct like:
unless -T $FH ...(do something) See http://perldoc.perl.org/perlfunc.html
But - - IMO - - it's "the long way around Robin Hood's barn" to code up file-type-test procedures and translate their output to something you can stick into $mime_msg->attach(Type => '.... unless you have some need to send files whose type is not readily discernable by inspection... or such a volume to send that inspection is impractical.
PS, just in case: the idiom marked with quotes in the previous para translates (roughly) to "the hard way" or "a poor way."
In reply to Re^3: MIME Lite no line feed in Message body
by ww
in thread MIME Lite no line feed in Message body
by sudheer157
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |