I am trying to use a peal script to send an email. I am using the program motion which will execute something when motion is picked up. I know motion is working correctly because when I type:

Code:
./email.pl
into the terminal from the directory that this file is from, I get the same result as I do when motion is running:

Code:
Content-type: text/html
and no email. I am using my same email account in the to and from fields, would that be a problem? Also, it's an external account, I don't have an email server set up.

I also tried using mutt but had no luck there. This was the closest thing I could find that seemed like it should work.

Is there something I am missing or will this not work?

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";

$title='A Test';
$to='myemail@domain.com';
$from= 'myemail@domain.com';
$subject='Test';

open(MAIL, "|/usr/sbin/sendmail -t");

## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL "This is a test\n";

close(MAIL);