#!/usr/bin/perl -w
use strict;
use diagnostics;
use CGI::Debug;
use CGI;

print "Content-type: text/html\n\n";


my $to = CGI::param('to');
my $from = CGI::param('from');

print "<h1>Mailar</h1>\n";

exit unless $to and $from;

open(MAIL, "| sendmail -f $from $to") or die;

print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: Hej\n\n";

print MAIL "Hejdå\n";

close MAIL;

print "<p>Klart!\n";
