Oh my gosh!! I totally forgot to post the code :( Sorry everyone...
#!/usr/bin/perl -w open (STDERR, ">>/home/sulfericacid/public_html/test/error.log") or die "Cannot open error log, weird...an error opening an error lo +g: $!"; use strict; use warnings; use POSIX; use CGI qw/:standard/; require SDBM_File; my %sig; my %emails; my $editsig; my $sigsave = "sig.dbm"; my $lock = "pass"; #password my $list = "list.dbm"; my $adminmail = "admin\@test.com"; my $sendmail = "/usr/lib/sendmail"; my $unsub = "http://sulfericacid.perlmonk.org/test/how.pl"; # uns +ub link tie %emails, 'SDBM_File', $list, O_CREAT | O_RDWR, 0644; if ( !tied %emails ) { print "database unsuccessful $!.\n"; } tie %sig, 'SDBM_File', $sigsave, O_CREAT | O_RDWR, 0644; if ( !tied %sig ) { print "database unsuccessful $!.\n"; } print header, start_html('Email Management'); print start_form(), table( Tr( td("Subject: "), td( textfield( -name => 'subject', -size => 40 ) ) ), Tr( td("Message: "), td( textarea( -name => 'message', -columns => 40, -rows => 5 ) ) ), Tr( td("Signature: "), td( textarea( -name => 'signature', -default => $sig{'default'}, -columns => 40, -rows => 5 ) ) ), Tr( td("Password: "), td( password_field( -name => 'password', -size => 10 ) ) ), Tr( td( checkbox(-name=>'use', -value=>'yes', -label=>'Use signature'), ) ), Tr( td( checkbox(-name=>'save', -value=>'yes', -label=>'Save signature'), ) ), td(submit('button','submit')) ), end_form(), hr(); if ( param() ) { # rid ourselves from those nasty params my $message = param('message'); my $password = param('password'); my $subject = param('subject'); my $signature = param('signature'); my $save = param('save'); my $use = param('use'); my $time = localtime; if ($password ne $lock) { print "Wrong password. Email rejected from server.\n"; } else { if ( $message eq "" || $subject eq "" ) { print "Your subject or email content was missing.\n"; exit; } else { if ( $save eq "yes" ) { print "<br>"; print "Saving to database<br>\n"; $sig{'default'} = $signature; $sig{'stored'} = $sig{'default'}; print "\$sig{'default'}: $sig{'default'}<br><br>\n"; } foreach my $key ( keys %emails ) { print "Things we have: $key <br>\n"; } print "<br>\n"; while ( my ( $key, $value ) = each(%emails) ) { # Email Subs, special commands $message =~ s/\[name\]/$value/g; #[name] = user name $message =~ s/\[time\]/$time/g; #[time] = time sent $message =~ s/\[unsub\]/$unsub/g; #[unsub] = unsubscribe + email $editsig = $signature; # so we can fiddle wit +h it $editsig =~ s/\[name\]/$value/g; #[name] = user name $editsig =~ s/\[time\]/$time/g; #[time] = time sent $editsig =~ s/\[unsub\]/$unsub/g; #[unsub] = unsubscribe + email $subject =~ s/\[name\]/$value/g; #[name] = user name open( MAIL, "| $sendmail -t" ); print MAIL "To: $key\n"; print MAIL "From: $adminmail\n"; print MAIL "Subject: $subject\n\n"; print MAIL "$message\n"; if ( $use eq "yes" && $signature ne "" ) { print MAIL "$editsig\n"; } print MAIL ".\n"; close(MAIL); print "Email was sent to: $key !<br>"; } } } } untie %emails; untie %sig;


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

In reply to Re: Variable substitution by sulfericacid
in thread Variable substitution by sulfericacid

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.