#!/usr/bin/perl -w
use strict;
use CGI::Debug;
use CGI qw( :standard );
use Net::SMTP;

my $from    = param('from')    || $ENV{'USER'};
my $to      = param('to')      or die;
my $subject = param('subject') || 'Ingen rubrik';
my $done    = param('done')    || "";
my $content = param('content') || "Inget innehåll";

my $smtp = Net::SMTP->new('localhost');
$smtp->mail( $from );
$smtp->to( $to );

my $mail = "";

$mail .= "To: $to\n";
$mail .= "From: $from\n";
$mail .= "Subject: $subject\n\n";
$mail .= $content;

$smtp->data( $mail );
$smtp->quit;  

# Om en svarssida finns definierad
if( $done )
{
    print redirect( $done );
}
else
{
    print header, start_html('Klart'), h1('Klart');
}



