in reply to S/MIME Encrypted Email
#!/usr/bin/perl -w use strict; use CGI; my $cgi = CGI->new(); my $certpath = "/path/to/where/you/store/certs"; my $sendmail = "/path/to/smime-0.7/send.pl"; #comes w/ smime for yo +ur convenience my $smime = "/path/to/smime-0.7/smime"; my %cert = ( 'chrisprosser@earthlink.net' => "$certpath/chrispro +sser_earthlink_net.pem" ); my $to = $cgi->param('to') || 'your@defaultaddr.com'; my $from = $cgi->param('email') || 'your@defaultuseradder.com +'; my $subject = $cgi->param('subject') || "Encrypted Email"; my @field = $cgi->param(); my $message = undef; # Loop through any of the fields sumbit to cgi foreach(@field) { my $field = $_; $field =~ s/_/ /go; $message .= "$field".("."x(15-length($_ +1)).": ".$cgi->param( +$_)."\n\n"; } { open(TXT, "|$smime -m text/html | $smime -e $cert{$to} | $sendmail +'$subject' $to $from >/dev/null"); local $/=undef; print TXT $message; close(TXT); } exit;
|
|---|