in reply to MIME::Lite returns "SMTP Failed to connect to mail server: Bad file descriptor"

Maybe two things. Not having sendmail installed and not having read the module's full documentation.

If you have a server that can send mails for you, there is the send_by_smtp method to which you can specify that server's name.

my $mailer = 'hostname'; $msg->send_by_smtp($mailer); # do some error checking