Thank you! So that's the entire program? After reading through the docs for MIME::Lite, you might want to specify MIME::Lite->send("smtp"); at the beginning of your program, after the use line.
(Adapted from the MIME::Lite documentation.)
Then go back to just $msg->send; . This is basically what jbrugger said in the first post, modified for the specifics of your system and without the if() statement.