You need just a small change to your code, I tested on my machine and it works.
You should change these lines and install Email::Sender::Simple module.
I know the documentation of Email::MIME is not very clear on how to send actually the email.
I use Email::Sender::Simple and works very fine, don't use the Mail::Sendmail. Here's the code:
print "end of mail as_string\n";
use Email::Sender::Simple qw(sendmail);
my $response = sendmail($email);
print "Response = $response\n";
print "error1 $!\n";