RE: Sending emails from ASP pages
by Charles A Upsdell <cupsdell(at)upsdell.com>
|
Date: |
Mon, 19 Aug 2002 19:36:31 -0400 |
To: |
hwg-techniques(at)hwg.org |
References: |
upsdell upsdell2 |
|
todo: View
Thread,
Original
|
|
>Thanks Chuck that is what I left out. Hard coding since it is only going
>to one person or email address. Set the form e-mail to only be to one
>user in the domain to deal with it.
>
>>It is easy to modify Matt's formmail.pl so that the recipient(s) are
>>hard-coded in the .pl procedure rather than in FORM parameters. This
>>makes it impossible to use it to relay email.
Actually, what I do is a bit more flexible. I set a recipient in the FORM,
but the recipient is a code rather than an email address, e.g. code 'wm'
for webmaster(at)upsdell.com. I have a code for each recipient I need. My
change to formmail.pl then maps the code into the proper email address.
Details: in the version of formmail I am working with (a variant of Matt's
version 1.9a) there is code of the form:
# The next six lines remove any extra spaces or new lines from the #
# configuration variables, which may have been caused if your editor #
# wraps lines after a certain length or if you used spaces between field #
# names or environment variables. #
$Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
I appended to this:
if ( $Config{'recipient'} eq '-' )
{ $Config{'recipient'} = 'mailbox'; }
elsif ( $Config{'recipient'} eq 'bn' )
{ $Config{'recipient'} = 'browser-news'; }
elsif ( $Config{'recipient'} eq 'sn' )
{ $Config{'recipient'} = 'security-news'; }
elsif ( $Config{'recipient'} eq 'wm' )
{ $Config{'recipient'} = 'webmaster'; }
else
{ $Config{'recipient'} = '-'; }
if ( $Config{'recipient'} ne '-' )
{ $Config{'recipient'} = $Config{'recipient'}.'(at)upsdell.com'; }
Modifying this is a snap: you don't even have to be a perl programmer. No
relaying is possible. And, as an added benefit, there is NO email address
in the HTML, which means that spammers can't rove through the HTML to look
for email addresses to victimize. A spammer could not even find a
complete email address in the .pl file to similarly victimize: they would
have to examine the perl code by hand.
The code could be more efficient, e.g. by using a hash of codes and
corresponding email addresses: but I wrote this code before I learned
perl, and I haven't needed to change it since. Something for me to do
later, I suppose.
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA