#!/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;

In reply to S/MIME Encrypted Email by Chris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.