PDA

View Full Version : sendmail - formmail on iis6


victorpb
12-14-2005, 05:10 PM
any advice here would be great.

I have setup a win2003 server with iis6. I previously had it up but blew it away and setup on larger drives. I had this form working properly but for some reason can not get it working now.

I copied over the form, formmail.pl, and sendmail.ini. I will include them below if anyone can give some pointers. I think it is just something dumb I am overlooking.

The form currently works, and will look at the criteria for sending and forward the person to the correct page for reject or success. The problem is it seems it is not finding the sendmail.exe program.

I installed perl into the c:\perl\bin directory - this is in the environment path, and perl is working or formmail would not. I then copied the sendmail.exe, and sendmail.ini into the same c:\perl\bin directory. I can run sendmail from a command prompt so the system is finding it.

I have also set the error log and debug logs to turn on, but they do not show up, unless I manually run it from the command prompt. That tell me again that sendmail.exe is not running.

I have a cgi-bin virtual mapped with the formmail in it. with read and scripts & executables access using the iis account.

I do not have a virtual for perl, or sendmail(exe, ini). I did try coping sendmail into the cgi directory to test it, but that did not work. I am totally frustrated with this one.

sendmail.ini ------------------------

; configuration for fake sendmail
[sendmail]
; you must change mail.mydomain.com to your smtp server
smtp_server=mail.blevons.com
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify
default_domain=blevons.com
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=seerror.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
debug_logfile=sedebug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=my username
auth_password=my password
; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines
; pop3_server=
; pop3_username=
; pop3_password=
; to force the sender to always be the following email address,uncomment and
; populate with a valid email address. this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content
; force_sender=
; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required
hostname=box





using matts formmail 1.92 script with the following variables -----------------

#!/usr/bin/perl - not sure if needed c:\perl\bin in path
# $mailprog defines the location of your sendmail program on your unix #
# system. The flags -i and -t should be passed to sendmail in order to #
# have it ignore single dots on a line and to read message for recipients #
# $SMTP_SERVER = "localhost"; - does not work
# $SENDMAIL = "sendmail -i -t"; - does not work
$mailprog = 'sendmail -i -t';
# @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 = ('buyerofhomes.com','192.168.2.200','blevons.com' );
# @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 = ('^buyer\@buyerofhomes\.com');
# @recipients = &fill_recipients('\@buyerofhomes\.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 = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');
# Done #


form webpage----------------------------

<form action="http://www.buyerofhomes.com/cgi-bin/FormMail.pl" METHOD="POST">
<div align="center">
<input type=hidden name="recipient" value="buyer@buyerofhomes.com">
<input type=hidden name="subject" value="Buyer of Homes Info Form">
<input type=hidden name="email" value="buyer@buyerofhomes.com">

<input type=hidden name="required" value="name, day_phone, evening_phone, your_email, street_address, city, county, state, zip, first_mort_balance, first_mort_payment, first_mort_holder, total_monthly_payment, how_much_owe">
<input type=hidden name="redirect" value="http://www.buyerofhomes.com/confirm.htm">
<input type=hidden name="missing_fields_redirect" value="http://www.buyerofhomes.com/reject.htm">

I REALLY appreciate anyones help.

TheShaner
12-14-2005, 06:10 PM
Change your shebang line to:

#!/perl/bin

The shebang you're using is not compatible with Windows.

-Shane

victorpb
12-14-2005, 06:15 PM
shane,

doesnt the # mean it is commented out? This is how I had it set on the other server, and it worked. I went ahead and tried it, still no luck.

any other thoughts?

FishMonger
12-14-2005, 06:49 PM
The shebang you're using is not compatible with Windows.Windows doesn't care about the path in the shebang line; it uses the file extension to associate it with Perl. However, when run in a cgi environment, the web server might, at least apache does. In that case you need to use the full path i.e., #!c:/perl/bin/perl.exe

doesnt the # mean it is commented out?That's correct in all other portions of the script, but not the shebang line.

The main problem I see is that you're using Matt's script. Even Matt, on his own site, doesn't recommend using it. Instead, he recommends using the nms formmail script.

http://www.scriptarchive.com/nms.html
http://nms-cgi.sourceforge.net/scripts.shtml

The next problem I see is that you're not providing the path to sendmail.

victorpb
12-14-2005, 06:57 PM
FishMonger,

Is the path specifing where the perl.exe is or the sendmail.exe. The perl script runs fine, it is just that there is not an email generated. I have the perl.exe in the same directory as the sendmail.exe. c:\per\bin\

I entered the full path as you mentioned, and still no email. Could this be a permissions issue on iis6, or file level?

Should the sendmail.exe be put in the perl\bin directory? Does it need to be a virtual directory for formmail to execute it?

thanks

victorpb
12-14-2005, 07:00 PM
one last thing. This is a windows 2003 domain controller, with exchange 2003 on the same box. I have installed the windows smtp app with IIS, and the fake sendmail.exe program off the Net.

the sendmail program should produce a log in the directory it resides if the program runs. When I run it from the command prompt it does produce a debug log. When called from formmail it does not have one. I can only think that formmail is working correctly because it does not error out, and it pushed the success page, or if all fields are not entered it pushes the reject page. It is just not running sendmail.exe.

any other thoughts would be appreciated.

FishMonger
12-14-2005, 07:22 PM
I've never used the "fake sendmail.exe" program you mention, nor do I know exactly which one you're refering to. The sendmail for Windows that most people use is the one from http://www.indigostar.com/sendmail.htm which is now called IndigoMail. Also, I haven't used IIS for a long time, I now use apache. When I have some free time, I'll take a closer look at your script postings to see if I can find anything else.

If you don't want to use the nms formmail script, my second recommendation would be to write your own scaled down version that would still be better than Matt's script. The very last choice would be to fix Matt's script.

victorpb
12-14-2005, 07:51 PM
hey fishmonger,

I went ahead and installed the nms cgi, and used the pointer for the local server bypassing the need for sendmail, and it works. thanks for the advice, its up and running.