We help IT Professionals succeed at work.

Need help setting up FormMail 1.9

amohat
amohat asked
on
Medium Priority
297 Views
Last Modified: 2013-12-25
I have a standard Interland 'virtual' hosting account. I ftp'd the FormMail.pl into the cgi-bin, making sure to use ASCII. I logged in via telnet and edited the Formmail.pl with what should be the right path for my perl interpreter:
/usr/bin/perl
and the path for my mail program, sendmail:
/bin/sendmail
And as per the setup instructions I listed my domain in the referers line, and my email in the recipients line. I also chmod'd the permissions to 755. That should be it for the cgi script, right?

On my form I have:
<form name="form1" method="POST" action="cgi-bin/FormMail.pl">
<input type=hidden name="recipient" value="my_email@my_domain.com">

When I hit the submit button, I get "Page Not Found".

What is the deal?

Before I did chmod, I got a "Not Allowed to View This Page" error. Afterwards, same old 500 error. It seems like the form can't even access the cgi file. Are my paths wrong? How can I be sure? I look at the directories and it looks right, starting from the root, /. This should be simple, and somehow I'm getting killed on this. Please help.
Comment
Watch Question

Author

Commented:
By the way, I set up and used another form emailer, cgiemail, and it works fine. Except I can't find enough documentation to get a redirect tag working. I can't use the ugly successful submission page it puts up. They both can be in the same cgi-bin, of course, right? See, this has got me thinking all crazy...
CERTIFIED EXPERT

Commented:
amohat,

"..When I hit the submit button, I get "Page Not Found"...."

Can you post the URL where one can see this problem first hand?

"..They both can be in the same cgi-bin, of course, right?..."

Without any code, URL & HTML code it will be difficult, if not impossible, to diagnose & fix the problem.

Is it at all possible for you to provide the username/password of your Interland acct? That would be the best, & fastest, way for me to look at the script and provide you with some kind of working solution.

If not, then i would suggest you post the exact formmail & cgiemail codes with their HTML files here.

Let me know.

Author

Commented:
maneshr, please email me at amohat@hotmail.com so that I can provide you with access. I would really appreciate your help!

In addition, here is the url of the form:
http://www.prideinstitute.com/InspirationStrategiesRegistration.htm (long winded I know, keep in mind that I'm taking over someone else's old unwanted project)

Here is the first part of FormMail.pl cgi, where I am supposed to configure the mandatory variables. I can post the whole thing, but it is rather long. Let me know.
#!/usr/bin/perl
##############################################################################
# FormMail Version 1.9 # # Copyright 1995-2001 Matt Wright
mattw@worldwidemart.com # # Created 06/09/95 Last Modified 08/03/01 # #
Matt4s Script Archive, Inc.:  http://www.worldwidemart.com/scripts/ #
##############################################################################
# COPYRIGHT NOTICE # # Copyright 1995-2001 Matthew M. Wright All Rights
Reserved.  # # # # FormMail may be used and modified free of charge by
anyone so long as this # # copyright notice and the comments above remain
intact.  By using this # # code you agree to indemnify Matthew M. Wright
from any liability that # # might arise from its use.  # # # # Selling the
code for this program without prior written consent is # # expressly
forbidden.  In other words, please ask first before you try and # # make
money off of my program.  # # # # Obtain permission before redistributing
this software over the Internet or # # in any other medium. In all cases
copyright and header must remain intact #
##############################################################################
# ACCESS CONTROL FIX: Peter D. Thompson Yezek # #
http://www.securityfocus.com/archive/1/62033 #
##############################################################################
# Define Variables # # Detailed Information Found In README File.  #

# $mailprog defines the location of your sendmail program on your unix       #
# system.                                                                    #

$mailprog = 4/bin/sendmail4;

# @referers allows forms to be located only on servers which are defined     #
# in this field.  This security fix from the last version which allowed      #
# anyone on any server to use your FormMail script on their web site.        #

@referers = (4prideinstitute.com4,4216.122.180.1844);

# @recipients defines the e-mail addresses or domain names that e-mail can   #
# be sent to.  This must be filled in correctly to prevent SPAM and allow    #
# valid addresses to receive e-mail.  Read the documentation to find out how #
# this variable works!!!  It is EXTREMELY IMPORTANT.                         #
@recipients = ^natchezs@prideinstitute.com;

# ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
# @valid_ENV allows the sysadmin to define what environment variables can    #
# be reported via the env_report directive.  This was implemented to fix     #
# the problem reported at http://www.securityfocus.com/bid/1187              #

@valid_ENV = (4REMOTE_HOST4,4REMOTE_ADDR4,4REMOTE_USER4,4HTTP_USER_AGENT4);

# Done                                                                       #
##############################################################################

Here is what should be the pertinent lines from the from. If you need to whole document, can you go to the above url and view source html code? Trying not to have a 50 page post here.
<form name="form1" method="get" action="cgi-bin/FormMail.pl">
        <input type="hidden" name="redirect" value="http://www.prideinstitute.com/Success.htm">
            <input type=hidden name="recipient" value="natchezs@prideinstitute.com">

Could the problem be the redirect tag? I seem to get the same 500 error but different resulting urls when I put in the redirect tag versus leave it out of the form.

"...post the...cgiemail codes..."
Do you think that the cgiemail could be a part of this? There is no mention of cgiemail in the form anymore. Cgiemail required a text file template to work. There is not mention of this in the FormMail documentation. Is this necessary?

Thanks again for your help!



CERTIFIED EXPERT

Commented:
amohat,

"..me at amohat@hotmail.com so that I can provide you with access. ..."

I have sent you an email a few minutes back.

"... There is not mention of this in the FormMail  documentation. Is this necessary?...."

once i have access to the system, i will focus my attention on fixing the Formmail problem.

if, & only if, i am unable to fix it will i look at the other email program.

Pl. let me know if this is fine with you.

Thanks.

Author

Commented:
maneshr, please email me at amohat@hotmail.com so that I can provide you with access. I would really appreciate your help!

In addition, here is the url of the form:
http://www.prideinstitute.com/InspirationStrategiesRegistration.htm (long winded I know, keep in mind that I'm taking over someone else's old unwanted project)

Here is the first part of FormMail.pl cgi, where I am supposed to configure the mandatory variables. I can post the whole thing, but it is rather long. Let me know.
#!/usr/bin/perl
##############################################################################
# FormMail Version 1.9 # # Copyright 1995-2001 Matt Wright
mattw@worldwidemart.com # # Created 06/09/95 Last Modified 08/03/01 # #
Matt4s Script Archive, Inc.:  http://www.worldwidemart.com/scripts/ #
##############################################################################
# COPYRIGHT NOTICE # # Copyright 1995-2001 Matthew M. Wright All Rights
Reserved.  # # # # FormMail may be used and modified free of charge by
anyone so long as this # # copyright notice and the comments above remain
intact.  By using this # # code you agree to indemnify Matthew M. Wright
from any liability that # # might arise from its use.  # # # # Selling the
code for this program without prior written consent is # # expressly
forbidden.  In other words, please ask first before you try and # # make
money off of my program.  # # # # Obtain permission before redistributing
this software over the Internet or # # in any other medium. In all cases
copyright and header must remain intact #
##############################################################################
# ACCESS CONTROL FIX: Peter D. Thompson Yezek # #
http://www.securityfocus.com/archive/1/62033 #
##############################################################################
# Define Variables # # Detailed Information Found In README File.  #

# $mailprog defines the location of your sendmail program on your unix       #
# system.                                                                    #

$mailprog = 4/bin/sendmail4;

# @referers allows forms to be located only on servers which are defined     #
# in this field.  This security fix from the last version which allowed      #
# anyone on any server to use your FormMail script on their web site.        #

@referers = (4prideinstitute.com4,4216.122.180.1844);

# @recipients defines the e-mail addresses or domain names that e-mail can   #
# be sent to.  This must be filled in correctly to prevent SPAM and allow    #
# valid addresses to receive e-mail.  Read the documentation to find out how #
# this variable works!!!  It is EXTREMELY IMPORTANT.                         #
@recipients = ^natchezs@prideinstitute.com;

# ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
# @valid_ENV allows the sysadmin to define what environment variables can    #
# be reported via the env_report directive.  This was implemented to fix     #
# the problem reported at http://www.securityfocus.com/bid/1187              #

@valid_ENV = (4REMOTE_HOST4,4REMOTE_ADDR4,4REMOTE_USER4,4HTTP_USER_AGENT4);

# Done                                                                       #
##############################################################################

Here is what should be the pertinent lines from the from. If you need to whole document, can you go to the above url and view source html code? Trying not to have a 50 page post here.
<form name="form1" method="get" action="cgi-bin/FormMail.pl">
        <input type="hidden" name="redirect" value="http://www.prideinstitute.com/Success.htm">
            <input type=hidden name="recipient" value="natchezs@prideinstitute.com">

Could the problem be the redirect tag? I seem to get the same 500 error but different resulting urls when I put in the redirect tag versus leave it out of the form.

"...post the...cgiemail codes..."
Do you think that the cgiemail could be a part of this? There is no mention of cgiemail in the form anymore. Cgiemail required a text file template to work. There is not mention of this in the FormMail documentation. Is this necessary?

Thanks again for your help!



CERTIFIED EXPERT

Commented:
amohat,

Got your email & replied to it.

Can you pl post the URL where i can login?

Let me know
CERTIFIED EXPERT

Commented:
amohat,

i went to the URL that you posted, logged in & then went to the "File Manager" tab.

once there, i can see a lot of directories.

i then went into the /usr/home/prideins/www/cgi-bin directory & saw the FormMail.pl file.

Please let me know if this is the file that you have been referring to.

Also, Pl. tell me the full path to the HTML file that calls Formmail.pl (/usr/home/prideins/www/htdocs/ ????)
CERTIFIED EXPERT

Commented:
amohat,

Status update:

i ssh'ed to your server & was able to see the FormMail.pl script.

I then created a backup of the original file, before i started working on it. This backup file is called FormMail.pl.orig

Also i created my personal copy of the file InspirationStrategiesRegistration.htm. i have called it maneshr_InspirationStrategiesRegistration.htm

So for diagnosing your problem, i am working with maneshr_InspirationStrategiesRegistration.htm & FormMail.pl.

Already i found some syntax problems with FormMail.pl. I have fixed them & the script now compiles properly.

i am now working of testing the script from the browser, via maneshr_InspirationStrategiesRegistration.htm file.

 i will keep you posted on any further developments.

Thanks
CERTIFIED EXPERT

Commented:
amohat,

Here is a sneak peek at the working FormMail.pl

To see this, pl visit
http://www.prideinstitute.com/maneshr_InspirationStrategiesRegistration.htm

& just click the "Submit" button. Let me know what you can see.

Author

Commented:
I get my Success.htm, as hoped for. Great! What was it, my paths, eh?

I still have not recieved an email at natchezs@prideinstitute.com yet. I assume you took that out as an interim troublshooting measure. Am I right, or are there other problems?
CERTIFIED EXPERT

Commented:
amohat,

Status Update:

Success!!!

i have been able to use the  maneshr_InspirationStrategiesRegistration.htm & FormMail.pl combination to send myself an email. i have forwarded the same to you for your reference.

Let me know if you would like to test the same, so that i can replace my email id with yours.

Thanks.

Author

Commented:
I get my Success.htm, as hoped for. Great! What was it, my paths, eh?

I still have not recieved an email at natchezs@prideinstitute.com yet. I assume you took that out as an interim troublshooting measure. Am I right, or are there other problems?
CERTIFIED EXPERT

Commented:
amohat,

"..Great! What was it, my paths, eh?..."

You wont believe me if i tell you :-)

The problem was due to some misaligned comments & the manner in which you have written the @recipients array.

Since i have kept a backup of the original file, you can see the exact changes i made anytime by using the following command.

NOTE: Remember to change to the /usr/home/prideins/usr/local/etc/httpd/cgi-bin directory before trying this command.

diff -w FormMail.pl FormMail.pl.orig

".. I assume you took that out as  an interim troublshooting measure. Am I right, or are there other problems? ..."

You  are right on with your assessment. since the script is working now, i have restoreD your email id & now you should start getting the emails.

Pl. test the same & let me know how it goes.

Thanks.

Author

Commented:
Why are my comments getting posted twice. Ugh. I *am not* hitting the button twice here!

I feel like crying! Wonderful! Do you mind telling me what I did wrong?

No, I can see it works fine. All that is needed now is to change the referers field back to my domain, prideinstitute.com, with recipients as ^natchezs@prideinstitute.com. Right?
CERTIFIED EXPERT

Commented:
amohat,

"..Do you mind telling me what I did wrong?..."

Nothing.

The problem was due to some misaligned comments & the manner in which you have written the @recipients  array. i think this misalignment  might be due to the transfer from Windows to a UN*X system.

"..All that is needed now is to change the referers field back to my domain,  prideinstitute.com, with recipients as ^natchezs@prideinstitute.com. Right? ..."

Done. in fact i have even sent you a test email.

Pl. let me know once you have received it.

Thanks.

Author

Commented:
I tried it a couple times and have not received any emails yet at natchezs@prideinstitute.com. Should I have? Otherwise it works great, no errors.
CERTIFIED EXPERT

Commented:
amohat,

"..Should  I have? .."

i think you should receive the email. i would suggest you check your "Junk Mail" folder. Hotmail pushed the first email that i received to that folder assuming it was spam email.

Let me know if have not received an email within the next 30 mins.

CERTIFIED EXPERT

Commented:
amohat,

BTW, Remember to use the following URL

http://www.prideinstitute.com/InspirationStrategiesRegistration.htm

i have deleted the temporary maneshr_InspirationStrategiesRegistration.htm file.

Author

Commented:
I tried it a couple times and have not received any emails yet at natchezs@prideinstitute.com. Should I have? Otherwise it works great, no errors.
CERTIFIED EXPERT

Commented:
amohat,

".. think you should receive the email. i would suggest you check your "Junk Mail" folder. Hotmail pushed
the first email that i received to that folder assuming it was spam email...."

Please ignore the above comment. i thought that you have amohat@hotmail.com in the FormMail & html files, instead of natchezs@prideinstitute.com

If you do not receive an email, then i would suggest you replace natchezs@prideinstitute.com with amohat@hotmail.com & see the actual email.

Author

Commented:
Well f---- me! I never did get any email at natchezs@prideinstitute.com. I did get an email at amohat@hotmail.com, in the bulk folder, where you said it would be. So I opened up the form and the .pl file to take a look, and BAM, I'm back at square one. Whatever I'm doing to it is messing it up. It's probably incorrectly formatted again. Damn! I am using a w2k box. If I telnet into the unix server, use pico, could I then access it without screwing everything up? I swear I didn't change anything! You're gonna deserve a medal for pulling my hide out of this one...

Author

Commented:
Man, I was so close...this is really hurting my feelings. i think I will just step away for a moment before I go insane. I hope that you might be able to save me before the new year. otherwise, cheers...
CERTIFIED EXPERT
Commented:
amohat,

".. I never did get any email at natchezs@prideinstitute.com. I did get an email at amohat@hotmail.com, ..."

As i expected. The problem is not with the script, but seems to be with the email id/email server or something with the email infrastructure. Therefore, i will consider this problem solved.

"..So I opened up the form and the .pl file to take a look,  and BAM, I'm back at square one. ."

No problem. I just removed the ^M characters from the end of each line & modified InspirationStrategiesRegistration.htm to point to FormMail.pl & it works fine.

You can test it at....
http://www.prideinstitute.com/InspirationStrategiesRegistration.htm

NOTE: i would suggest you test using your hotmail id rather than the prideinstitute id.

"..f I telnet into the unix server, use pico, could I then  access it without screwing everything up?.."
Although i have never used pico myself, i think the answer is "Yes this will not mess up the code"

Author

Commented:
Man, I was so close...this is really hurting my feelings. i think I will just step away for a moment before I go insane. I hope that you might be able to save me before the new year. otherwise, cheers...

Explore More ContentExplore courses, solutions, and other research materials related to this topic.