22 May, 2009, Hades_Kane wrote in the 1st comment:
Votes: 0
Until recently, I've used the 'wwwtoolz' feature for setting up a form mailer. For a while now, since I run all of my stuff on a VPS, I've been meaning to get around to figuring out how to make my own form mailer work. I use it for people to be able to apply to build on the webpage (http://www.eotmud.com/apply.html) and that is very convenient. Well, wwwtoolz apparently went down last week, and so my hand has been forced to go ahead and get this done :p

I guess my question is if anyone else is running a VPS and has configured a script for this. I understand I'll probably have to install something in my server to handle sending emails, probably cgi, and other stuff. I guess I'm just fishing for a good place to start if anyone has any suggestions.

Thanks in advance!
22 May, 2009, Zeno wrote in the 2nd comment:
Votes: 0
22 May, 2009, Hades_Kane wrote in the 3rd comment:
Votes: 0


Nope, not quite. That just brings up your default mail program and its ultimately up to the user to actually send the email. For people like myself, who only uses webmail (such as hotmail) that doesn't really do much other than provide something to copy/paste to email myself. What I'm looking to do is have the server handle all of it. I fill out the information, hit send, and then the server takes care of emailing it to a specified email address.
22 May, 2009, Zeno wrote in the 4th comment:
Votes: 0
22 May, 2009, Hades_Kane wrote in the 5th comment:
Votes: 0
I did a bit of digging and I think this might be what I'm after:

http://www.scriptarchive.com/formmail.ht...

I'm going to try to get this working this weekend and I'll report back.
23 May, 2009, Skol wrote in the 6th comment:
Votes: 0
If you need a perl one, I found/reworked one a while back.
If I remember right, I found the perl script and wrote the javascript and retooled
the perl, been years though, any copyright statements should still be there and
left there if used.

Uses sendmail and all that, not sure what privs you have on VPS though.

The HTML side of it:
<script language="JavaScript1.1" src="../javascript/emailer.js"></script>     
</p>
<form name="emailForm">
<table border="0" width="572" cellspacing="2"
cellpadding="1" height="163">
<tr>
<td bgcolor="#dcdcdc" width="142">
<p>Full Name</p>
</td>

<td><input name="First_Name" size="15"
type="text">
<input name="Middle_Initial" size="2"
maxlength="1" type="text">
<input name="Last_Name" size="37"
type="text"></td>
</tr>
<tr>
<td bgcolor="white" width="142">
<p>Subject</p>
</td>

<td><input name="Subject" size="39" type="text">
</td>
</tr>
<tr>
<td bgcolor="#dcdcdc" width="142">
<p>Email Address</p>
</td>
<td><input name="Email_Address" size="39" type="text"></td>

</tr>
<tr>
<td colspan="2"><font size="2"><textarea name="Comments" rows="15"
cols="70" wrap="virtual">
Your questions or comments go here.</textarea></font></td>
</tr>
<tr bgcolor="white">
<td colspan="2" bgcolor="white"><b>Click <input type="button"
value="Finish" onclick=ShowEmail()>
to preview your email.</b></td>
</tr>

</table>
</form>


Javascript file (save as the above named file):
/* Dave writes too much code ;p */

// This function only allows numbers, letters, and characters that do not
//interfere with the code
function validated(string) {
for (var i=0, output='', valid=" '0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/?
[]-=_+!@#$%&()<>:"; i<string.length; i++)
if (valid.indexOf(string.charAt(i)) != -1){
if (valid.indexOf(string.charAt(i)) == '1'){
output += '\''
continue;
}
output += string.charAt(i)
}
return output;
}

// This function is almost identical with validated above, but replaces spaces
with underscores for naming purposes.
function valname(string) {
for (var i=0, output='', valid=" '0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/?
[]-=_+!@#$%&()<>:"; i<string.length; i++)
if (valid.indexOf(string.charAt(i)) != -1){
if (valid.indexOf(string.charAt(i)) == 0){
output += "_"
continue;
}
if (valid.indexOf(string.charAt(i)) == '1'){
output += '\''
continue;
}
output += string.charAt(i)
}
return output;
}
function valcom(string) {
for (var i=0, output='', valid=" '\"&\n0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ.,?[]-=_+!@%()<>:"; i<string.length; i++)
if (valid.indexOf(string.charAt(i)) != -1){
if (valid.indexOf(string.charAt(i)) == '1'){
output += '\''
continue;
}
if (valid.indexOf(string.charAt(i)) == '2'){
output += '\'\''
continue;
}
if (valid.indexOf(string.charAt(i)) == '3'){
output += '\&'
continue;
}
if (valid.indexOf(string.charAt(i)) == '4'){
output += '<br>'
continue;
}
output += string.charAt(i)
}
return output;
}

function ShowEmail(First_Name, Email_Address, Comments){

First_Name = validated(document.emailForm.First_Name.value)
Middle_Initial = validated(document.emailForm.Middle_Initial.value)
Last_Name = valname(document.emailForm.Last_Name.value)
Email_Address = validated(document.emailForm.Email_Address.value)
Comments = valcom(document.emailForm.Comments.value)
Subject = validated(document.emailForm.Subject.value)

EmailCreate=window.open("","email_preview","HEIGHT=300,WIDTH=500,
scrollbars=yes,resizable=yes,top=10,left=200");
EmailCreate.document.write
("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r");
EmailCreate.document.write ("<html>\r");
EmailCreate.document.write ("\t<head>\r");
EmailCreate.document.write ("\t\t<title>ATACards.com Email Confirmation</title>\r");
EmailCreate.document.write ("\t\t<meta HTTP-EQUIV=\" pragma\" CONTENT=\"no-cache\">\r");
EmailCreate.document.write ("\t\t<meta NAME=\"copyright\" content=\"&copy;
Copyright 2004 by Burkey &amp; Leverich, ATACards.com\">\r");
EmailCreate.document.write ("\t\t<meta NAME=\"author\"
content=\"ATACards.com, David Leverich\">\r");
EmailCreate.document.write ("\t\t<meta NAME=\"GENERATOR\"
CONTENT=\"This page was created by custom ATAcards.com
Javascript, creating each page dynamically.\">\r");
EmailCreate.document.write ("\t\t
<link href=\"http://www.atacards.com/styles/style.css..." rel=\"stylesheet\"
media=\"screen\">\r\t</head>\r");
EmailCreate.document.write ("\r");
EmailCreate.document.write ("\t<body BGCOLOR=\"white\"
onload=\"window.focus();\">\r");
EmailCreate.document.write ("\t\t<div align=\"center\">\r");

EmailCreate.document.write ("<img src=\"http://www.atacards.com/images/ATAC_logo..."
alt=\"ATAcards.com -
Your source for proffessional
ATA Business Cards\"><p>&nbsp;</p>\r");
EmailCreate.document.write ("\t\t<table width=\"480\"
border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r");
EmailCreate.document.write ("\t\t<tr bgcolor=\"orange\"><td><P class=\"smaller\">
<b>Please check your email information, if it is accurate,
click below.</b></p></td></tr>\r");
EmailCreate.document.write ("\t\t\t<tr bgcolor=\"#dcdcdc\">
<td><p class=\"smaller\">Name: ");
// Error handling, this disallows the order without at least an initial
if (First_Name == ""){
EmailCreate.document.write ("(<font color=\"red\"><b>Name?</b></font>)");
}
else {
EmailCreate.document.write (First_Name, " ");
}
// This just puts punctuation and spacing after a middle initial if it's found
if (Middle_Initial == ""){
}
else {
EmailCreate.document.write (Middle_Initial, ". ");
}
// Again, no last name, it barfs
if (Last_Name == ""){
EmailCreate.document.write ("(<font color=\"red\"><b>Last Name?</b></font>)");
}
else {
EmailCreate.document.write (Last_Name);
}
EmailCreate.document.write ("</p></td></tr>\r");
EmailCreate.document.write ("\t\t\t\t<tr bgcolor=\"white\">
<td><p class=\"smaller\">Email Address: ");
// Let's the customer know that the email address was omitted,
//they then need the shipping email below
if (Email_Address == ""){
EmailCreate.document.write ("(<font color=\"red\"><b>Reply Email Required</b></font>)");
}
else{
EmailCreate.document.write (Email_Address);
}
EmailCreate.document.write ("</p></td></tr>\r");

EmailCreate.document.write ("\t\t\t\t
<tr bgcolor=\"#dcdcdc\"><td><p class=\"smaller\">Email Subject: ");
// Let's the customer know that the email address was omitted,
// they then need the shipping email below
if (Subject == ""){
EmailCreate.document.write ("ATAcards Contact - No subject");
}
else{
EmailCreate.document.write ("ATAcards.com - ", Subject);
}
EmailCreate.document.write ("</p></td></tr>\r");

EmailCreate.document.write ("\t\t\t<tr><td><fieldset><legend>Email Content:</legend>\r");
EmailCreate.document.write ("\t\t\t\t<p class=\"smaller\">");
if (Comments == ""){
EmailCreate.document.write ("(<font color=\"red\">
<b>Email Content Required</b></font>)");
}
else {
EmailCreate.document.write ("<div align=\"center\"><table width=\"400\">
<tr><td><p class=\"noindentsmaller\">",
Comments, "</p></td></tr></table><\div>\n");
}

EmailCreate.document.write ("</p></fieldset><br></td></tr>\r");

EmailCreate.document.write ("\t\t<tr bgcolor=\"orange\"><td>
<P class=\"smaller\"><b>If you wish to <a onclick=\"window.blur()\">change</a>
this email information, <br>make necessary changes on email
form and re-click 'Finish' to change your email.</b></p></td></tr></table>\r");


EmailCreate.document.write ("<form name=\"email_form\"\r");
EmailCreate.document.write ("action=\"/cgi-bin/emailer.cgi\" method=\"POST\">\r");

EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"First_Name\"
VALUE=\"", First_Name, "\">\r");
EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"Middle_Initial\"
VALUE=\"", Middle_Initial, "\">\r");
EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"Last_Name\"
VALUE=\"", Last_Name, "\">\r");
EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"nameField\"
VALUE=\"", Last_Name, ", ", First_Name, " ", Middle_Initial, ". ", "\">\r");

EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"Comments\"
VALUE=\"", Comments, "\">\r");
EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"Email_Address\"
VALUE=\"", Email_Address, "\">\r");
EmailCreate.document.write ("<INPUT TYPE=\"hidden\" NAME=\"Subject\" VALUE=\"",
Subject, "\">\r");

EmailCreate.document.write ("<center><INPUT TYPE=\"submit\"
VALUE=\"Send your email to ATAcards!\"></center>\r");
EmailCreate.document.write ("</form>\r");


EmailCreate.document.write ("\t\t</div>\r");
EmailCreate.document.write ("\t</body>\r");
EmailCreate.document.write ("</html>\r");
EmailCreate.document.close();
return false;
}


Then the perl script it hits is (emailer.cgi in cgi-bin, chmod it to run etc):
#!/usr/bin/perl

use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);

######################## Program Header #########################################
##
## Copyright (C) 2004 Poetic Pollution
## Script Name: BareBonesMailer
## Version: 0.2.2
## URL: http://poeticpollution.net/scripts/BareB...
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## Please read the full GNU GPL: http://www.gnu.org/copyleft/gpl.html
##

##### Variables #####
## Edit as needed…

# Path to sendmail
$mailProg = "/usr/sbin/sendmail -t";

# Your email address and be sure to leave the \ in front
# of the @ or else you'll get errors.. ;)
$toEmail = "questions\@atacards.com";

# Redirect them to this URL:
# This should be a pre-existing file with a thank you
# message or something similar..
$redirectURL = "http://www.atacards.com/contact/email_se...";

# Your time zone difference from GMT
$offSet = "-7";

# Military time 0 = off 1 = on
$milTime = 0;


##### Mailer ####

$fromName = param('nameField');
$formFirstname = param ('First_Name');
$formInitial = param ('Middle_Initial');
$formLastname = param ('Last_Name');
$fromEmail = param('Email_Address');
$formComments = param('Comments');
$formSubject = param ('Subject');

$formErrstart = ("<font color=\"red\"><b>* ");
$formErrend = ("</b></font>");
$formMissyntax = "(missing \@ or . symbol)";

# Create Order Status Page with Error Handling
unless(($formLastname)
&& ($formFirstname)
&& ($formComments)
&& (($fromEmail) && ($fromEmail =~ /.*\@.*/))
&& (($fromEmail) && ($fromEmail =~ /.*..*/))){
&headerFooter;
print qq|<p class="noindent">There are <font color="red"><b>missing</b></font> or
<font color="red"><b>incorrect fields</b></font> in your email.<br>\n|;
print qq|Please double check them on the <a href="#" onclick="window.blur();">
contact page</a> and re-click Finish..</p>\n|;

print qq|<table width="480" border="0" cellspacing="0" cellpadding="0">\n|;
print qq|<tr bgcolor="green"><td colspan="2"><p class="light">\n<b>
Your email shows the following information:</b></p></td></tr>|;
print qq| <tr bgcolor="#dcdcdc"><td><p class="smaller">|;
if (((!$formFirstname) && (!$formLastname)) ||
((!$formFirstname) || (!$formLastname))){
print qq|$formErrstart|;
}
print qq|Name: |;
if (((!$formFirstname) && (!$formLastname)) ||
((!$formFirstname) || (!$formLastname))){
print qq|$formErrend|;
}
print qq|</p></td><td><p class="invo">|;
if (!$formFirstname){
print qq|($formErrstart|;print qq|Name?|;print qq|$formErrend)|;
}
else {
print qq|$formFirstname |;
}
if (!$formInitial){
print qq||;
}
else{
print qq|$formInitial. |;
}
if (!$formLastname){
print qq|($formErrstart|;print qq|Last Name?|;print qq|$formErrend)|;
}
else {
print qq|$formLastname |;
}

print qq|</p></td></tr>\n|;
print qq| <tr><td><p class="smaller">|;

if (!$fromEmail){
print qq|$formErrstart|;print qq|Email Address:|;print qq|$formErrend|;
}
else {
print qq|Email Address:|;
}
if (($fromEmail) && (($fromEmail !~ /.*\@.*/) || ($fromEmail !~ /.*\..*/))){
print qq|$formErrstart|;
print qq|Email:|;
print qq|$formMissyntax|;
print qq|$formErrend|;
}

print qq|</p></td>\n|;
print qq| <td><p class="invo">|;
if (!$fromEmail){
print qq|($formErrstart|;print qq|Email Required|;print qq|$formErrend)|;
}
else {
print qq|$fromEmail|;
}
print qq|</p></td></tr>\n|;

print qq| <tr><td colspan="2"><p class="smaller">|;
if (!$FormComments){
print qq|$formErrstart|;print qq|Email Content:$formErrend|;
}
else {
print qq|Email Content:|;
}
print qq|</p>\n|;
print qq| <p class="smaller">|;
print qq|$formComments</p></td></tr>\n|;


print qq|<tr bgcolor="green"><td colspan="2"><p class="light"><b>|;
print qq|Please fix or make the entries shown in red on the contact page, <br>\n|;
print qq|You may then click the finish button again and
this window will show your email.</b></p>\n|;
print qq|</td></tr></table>\n\n|;


print @footer;
exit;
}


@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@time = gmtime(time + (3600 * $offSet));

$newMinSec = sprintf("%02d:%02d",$time[1],$time[0]);
$newDay = sprintf("%02d",$time[3]);
$years = $time[5] + 1900;

if ($milTime) { $hours = sprintf("%02d",$time[2]); }
else {
if ($time[2] < 12) { if ($time[2] == 0) { $hours = 12; }
else { $hours = $time[2]; } $amPm = " AM"; }
else { if ($time[2] > 12) { $hours = $time[2] - 12; }
else { $hours = $time[2]; } $amPm = " PM"; }
}

$dateFormat = "$newDay/$months[$time[4]]/$years at $hours:$newMinSec$amPm";

$remoteAddress = $ENV{'REMOTE_ADDR'};
$remoteHost = $ENV{'REMOTE_HOST'};
@subnetNumbers = split (/\./, $remoteAddress);
$packedAddress = pack ("C4", @subnetNumbers);
($remoteHost) = gethostbyaddr ($packedAddress, 2);

# Start of Email back to ATAcards
open(MAIL, "|$mailProg") || die "Unable to open Mail Program.";
print MAIL "To: $toEmail\n";
print MAIL "From: \"$formFirstname $formLastname\" <$fromEmail>\n";
print MAIL "Subject: ATAcards WebEmail- $formSubject\n";
print MAIL "Date: $dateFormat.\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: text/html;";
print MAIL "charset=\"iso-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: 8bit\n\n";

# HTML Part
print MAIL "<x-html><!x-stuff-for-pete base=\"\" src=\"\" id=\"0\"
charset=\"\"><!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
print MAIL "<HTML><HEAD>\n";
print MAIL "<META http-equiv=Content-Type content=\"text/html; charset=windows-1252\">\n";
print MAIL "<link href=\"http://www.atacards.com/styles/style.css..."
rel=\"stylesheet\" media=\"screen\">\n";
print MAIL "</HEAD>\n";
print MAIL "<BODY bgColor=#ffffff>\n";
print MAIL "<img src=\"http://www.atacards.com/images/ATAC_logo...";
print MAIL "<font color=\"blue\">\n";
print MAIL "<p class=\"noindent\">Name: $fromName<br>\n";
print MAIL "Email: $fromEmail</p>\n";
print MAIL "<p class=\"noindent\">$formComments</p>\n";
print MAIL "</font>\n";
print MAIL "<p>&nbsp;</p><p class=\"noindent\">End Transmission</p>\n";
print MAIL "</PRE></BODY></HTML>\n\n";
print MAIL "</x-html>\n";

close(MAIL);

# End of email to ATAcards
# _________________________________________________________

# End of Email
print "Location: $redirectURL\n\n";

exit;

sub headerFooter {
# ————————————————
open (FILE, "email-template.html")
|| die "Unable to open the Mailer Template for reading..";
@HTMLFile = <FILE>;
close(FILE);

for ($a = 0; $a < @HTMLFile; $a++)
{ if ($HTMLFile[$a] =~ /<!– mailer output will be here –>/) { $foundIt = 1; last; } }
unless($foundIt) { die "HTML comments not found in the Email Template.."; }

for ($i = 0; $i < $a; $i++) { push(@header, $HTMLFile[$i]); }
for ($i = $a; $i < @HTMLFile; $i++) { push(@footer, $HTMLFile[$i]); }

print "Content-type: text/html\n\n";
print @header;
}


Template file to print to: (email-template.html)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ATAcards.com Email Contact - Error</title>
<meta HTTP-EQUIV=" pragma" CONTENT="no-cache">
<meta NAME="copyright" content="&copy; Copyright 2007 David S. Leverich, ATACards.com">
<meta NAME="author" content="ATACards.com, David Leverich">
<meta NAME="GENERATOR"
CONTENT="This page was created by custom ATAcards.com
Perlscript, creating each page dynamically.">
<link href="http://www.atacards.com/styles/style.css" rel="stylesheet" media="screen">
</head>
<body bgcolor="white">
<div align="center"><img src="http://www.atacards.com/images/ATAC_logo..."
alt="ATAcards.com - Your source for proffessional ATA Business Cards">
<h2 class="noindent">ATAcards.com Email Contact Error</h2>

<!– mailer output will be here –>

</div>
</body></html>


Then the 'after post' page: (email_sent.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ATACards.com Email Sent!</title>
<meta HTTP-EQUIV=" pragma" CONTENT="no-cache">
<meta NAME="copyright" content="&copy; Copyright 2004 ATACards.com, David S. Leverich">
<meta NAME="author" content="ATACards.com, David Leverich">
<link href="http://www.atacards.com/styles/style.css" rel="stylesheet" media="screen">

</head>

<script LANGUAGE="JavaScript">
<!–
function closeit() {
window.close();
}
//–>
</script>


<body BGCOLOR="white" onload="window.focus(); window.setTimeout('closeit()', 8000);">
<div align="center">
<img src="http://www.atacards.com/images/ATAC_logo..."
alt="ATAcards.com - Your source for proffessional ATA Business Cards"><p>&nbsp;</p>
<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr><td>
<h3>ATAcards - Thank you for your Email!</h3>
<p>Your Email has been sent to Mr. Leverich.</p>
<p>Feel free to select any of our areas to the left,
or view our costs &amp; specifics or FAQ's on the chevron links above.</p>
<p> This window will close in a few seconds.</p>
<p></p>
<p>- David Leverich.</p>


</td></tr>
</div>
</body>
</html>
23 May, 2009, Skol wrote in the 7th comment:
Votes: 0
Ps. <– Sorry for blowing the walls off the thread. –>
23 May, 2009, David Haley wrote in the 8th comment:
Votes: 0
Skol said:
Ps. <– Sorry for blowing the walls off the thread. –>

You can fix that by wrapping the lines manually where they're too long – it'll make the thread easier to follow. :smile:
23 May, 2009, Banner wrote in the 9th comment:
Votes: 0
*coughs about the broken formatting of the post which he himself was yelled at for doing a few months back*

I didn't know much about form mailing either until I found this. It's extremely easy to set up and works wonders. Even has built in captcha support (although it never works for me), ability to hide your emails from the html files, ect. A lot of it I don't even use but its there if you need it.
http://www.tectite.com/formmailpage.php
23 May, 2009, Skol wrote in the 10th comment:
Votes: 0
Ok, fixed the formatting, now back to the thread ;p
30 May, 2009, Hades_Kane wrote in the 11th comment:
Votes: 0
And about 7 hours later… I have my form mailer working.

I can't express how much I hate Linux, and how much I hate trying to get sendmail/postfix blah blah working.
30 May, 2009, Hades_Kane wrote in the 12th comment:
Votes: 0
Ok, I spent a while trying to figure this out and I couldn't.

This is the script I went with:
http://www.scriptarchive.com/formmail.ht...
http://www.scriptarchive.com/readme/form...

What I'm trying to do is this…
Where I have in the html:
<input type="hidden" name="recipient" value="myemail@mydomain.com">


I'd like to be able to use an alias as the 'value' something like "eotapp" or something, and then have the script be able to take "eotapp" or whatever alias I use and read that as the email address I would otherwise put in there. Basically, I'm trying to hide my email address within the HTML part of the code to avoid spam bots and whatnot.

I'm quite sure there's a way to do this within the script itself. Even a solution for just removing the recipient value in the form altogether and just having it hardcoded to go to one location regardless would be acceptable, but I would prefer to be able to add in aliases for different email addresses as I do host more than one site/domain on my VPS and it may be possible that more than one user would like to utilize the form mailer script.

Anyone here know enough Perl to be able to help me out?

I'd greatly appreciate it.
30 May, 2009, elanthis wrote in the 13th comment:
Votes: 0
Quote
I'd like to be able to use an alias as the 'value' something like "eotapp" or something, and then have the script be able to take "eotapp" or whatever alias I use and read that as the email address I would otherwise put in there. Basically, I'm trying to hide my email address within the HTML part of the code to avoid spam bots and whatnot.


You fail to understand how spam bots work. DO NOT PUT THE EMAIL ADDRESS ANYWHERE IN THE FUCKING HTML. Put it in the backend script only. Spambots don't care what you call the fields, they scan the raw text for anything formatted like an email address, and they're smart enough to work around most common anti-spam "obfuscation" techniques.

That rule is really just a corollary of this one: DON'T LET THE HTML FORM TELL YOU WHERE TO SEND THE MAIL! That creates an "open mailer" and makes you an idiot responsible for a large portion of the spam people receive. The backend script AND NOTHING ELSE must be specifying where to send the mail. If you want a single form to target several email addresses, give the form a select field with values like 'support' and 'applications' and then let the backend script map those to the actual recipient addresses.

Breaking either of those rules should be grounds for having your Internet License revoked and/or being shot in the face.
30 May, 2009, Guest wrote in the 14th comment:
Votes: 0
Heh, such harshness, but yes. The general principle is one I fully agree with. There's a reason nobody in their right mind uses those old form mailer scripts anymore.
30 May, 2009, Cratylus wrote in the 15th comment:
Votes: 0
Samson said:
Heh, such harshness, but yes. The general principle is one I fully agree with. There's a reason nobody in their right mind uses those old form mailer scripts anymore.


Perhaps they've been shot in the face.
31 May, 2009, Guest wrote in the 16th comment:
Votes: 0
Perhaps they have. I guess we'll never know :)
31 May, 2009, Banner wrote in the 17th comment:
Votes: 0
Hades_Kane said:
Ok, I spent a while trying to figure this out and I couldn't.

This is the script I went with:
http://www.scriptarchive.com/formmail.ht...
http://www.scriptarchive.com/readme/form...

What I'm trying to do is this…
Where I have in the html:
<input type="hidden" name="recipient" value="myemail@mydomain.com">


I'd like to be able to use an alias as the 'value' something like "eotapp" or something, and then have the script be able to take "eotapp" or whatever alias I use and read that as the email address I would otherwise put in there. Basically, I'm trying to hide my email address within the HTML part of the code to avoid spam bots and whatnot.

I'm quite sure there's a way to do this within the script itself. Even a solution for just removing the recipient value in the form altogether and just having it hardcoded to go to one location regardless would be acceptable, but I would prefer to be able to add in aliases for different email addresses as I do host more than one site/domain on my VPS and it may be possible that more than one user would like to utilize the form mailer script.

Anyone here know enough Perl to be able to help me out?

I'd greatly appreciate it.


Banner said:
I didn't know much about form mailing either until I found this. It's extremely easy to set up and works wonders. Even has built in captcha support (although it never works for me), ability to hide your emails from the html files, ect. A lot of it I don't even use but its there if you need it.
http://www.tectite.com/formmailpage.php

Works in under a minute if you plug your email in, under two for the email aliases. I don't know how much more simple it can get.
31 May, 2009, Hades_Kane wrote in the 18th comment:
Votes: 0
elanthis said:
DO NOT PUT THE EMAIL ADDRESS ANYWHERE IN THE FUCKING HTML.


Can you seriously not fucking read, or are you just too stupid to understand the English language?

The entire point of my post is asking how to avoid putting my email address in the HTML and instead have email address listed in the CGI script itself, and just have the HTML point to an alias that the script recognizes and supplies the appropriate email address when it sends.

The script is already set to only send from a combination check of both domain and IP address, and is set to only be valid to send to a specific email address, so there shouldn't be any issue in people using the script to to spam anyone.

So, if anyone that doesn't have their head buried up their ass and can actually read would like to offer some actual helpful advice, I'd still be really appreciative.
31 May, 2009, Hades_Kane wrote in the 19th comment:
Votes: 0
Banner said:
Banner said:
I didn't know much about form mailing either until I found this. It's extremely easy to set up and works wonders. Even has built in captcha support (although it never works for me), ability to hide your emails from the html files, ect. A lot of it I don't even use but its there if you need it.
http://www.tectite.com/formmailpage.php

Works in under a minute if you plug your email in, under two for the email aliases. I don't know how much more simple it can get.


I keep missing that I'm not replying to the most current thread, and saw this after I posted my last.

I've just glanced at that link, Banner, and I'll give that a try tomorrow, I appreciate the help. I will feel silly if this doesn't use sendmail or postfix and I wasted my entire Friday evening wrangling with that…
31 May, 2009, Banner wrote in the 20th comment:
Votes: 0
Hades_Kane said:
Banner said:
Banner said:
I didn't know much about form mailing either until I found this. It's extremely easy to set up and works wonders. Even has built in captcha support (although it never works for me), ability to hide your emails from the html files, ect. A lot of it I don't even use but its there if you need it.
http://www.tectite.com/formmailpage.php

Works in under a minute if you plug your email in, under two for the email aliases. I don't know how much more simple it can get.


I keep missing that I'm not replying to the most current thread, and saw this after I posted my last.

I've just glanced at that link, Banner, and I'll give that a try tomorrow, I appreciate the help. I will feel silly if this doesn't use sendmail or postfix and I wasted my entire Friday evening wrangling with that…

Works with both. I'm currently using the aliased email option with the script I linked, so I can provide help if you don't get it working. Basically, you stick the emails in a file (which I have in an obscure passworded directory), link the formmail script to that file, then you don't even have to have the emails in the html file because the form mailer automatically knows which emails to send it to via the field you specify in the file.
0.0/34