#!/usr/bin/perl -w use CGI qw(redirect); use strict; $| = 1; if (my $pid = fork) { print redirect 'http://www.whatever.com'; } else { close STDIN; close STDOUT; # do your mail sending here }