in reply to Re^2: mail script with attachment
in thread mail script with attachment

But, where is $line defined?

See $/ to slurp the file in a variable