in reply to Sending mail: setting envelope id
$envid = 'Original-Envelope-ID: <whatever-envid-is>'; chop(my $date = `date "+%m/%d/%y-%H:%M%p GMT-5"`) my $mailer = qx!which sendmail!; if ( $? eq 0 ) { $recip = 'thereal@domain.com'; $fromaddr = 'realname <bla@bla.net>'; $subject = "thesubject"; $xmailer = "cgi"; $mailmessage = qq| A text message... |; } else { $mailer = "failed"; }
sub dispatch { open(MAILPIPE,"|$mailer"); print MAILPIPE "To: $recip\n"; print MAILPIPE "From: $fromaddr\n"; print MAILPIPE "Subject: $subject\n"; print MAILPIPE "Date: $date\n"; print MAILPIPE "$envid\n" if $envid; #here print MAILPIPE "X-Mailer: $xmailer\n"; print MAILPIPE "$mailmessage\n"; close(MAILPIPE); } &dispatch unless $mailer eq "failed";
|
|---|