Form Mail

Questions from a newbie,

I currently have a cgi script that calls for sendmail to send emails via a web form. I have read about switching the function to mail(). Honestly I don't know where in the script to do that. Any help would be greatly appreicated.
 
mail() is a built-in PHP function, not Perl CGI.
I'm sure there are several of perl modules for mailing though.
 
Is it possible to call a php script via an html webpage, and if so do you think that would work for me? Instead of using the perl script.
 
I have one that works so far as to give you the impression that it is sending the email, but it doesn't actually send the message. PHP is all very new to me, so I'm sure there is something that I am not doing right.

BTW,
The page in question is at Contact Page

and the script I'm playing with is attached. It acts like it sent the message, but really doesn't.
 

Attachments

  • mail.txt.txt
    12.3 KB · Views: 91
I'm not exactly sure what's going on here.. You named the file formail.asp, but it's a PHP script. I suppose you could add the .asp extension to be handled by PHP via the control panel, but still...
The script seems to be executing, because it's redirecting you to the result page, so I'll assume that's what you did.

From what I can see, the various fields in your HTML form don't have the proper names. _recipients should be email_to, from should be name_from, email should be email_from and _subject should be subject. I think it might start working when you change those :)

Using a mailform script such as this one is a bad idea by the way. The recipient of the mail is specified in the HTML form and no validation is being done on that in the script itself, which means basically anyone can use your mailform script to send spam to anyone they please (which I doubt JodoHost would appreciate).

The script seems to have support built in for referrer checking, but that won't stop anybody that knows what he's doing from abusing the form either.

Also, ASP or PHP scripts don't need to be (and shouldn't be) in your cgi-bin directory.
 
Subspace is exactly right, no need for CGI-BIN, also php would run as .asp if assigned, but is best to run as .php
 
Yeah, I change it to the asp script after I last submitted my last post playing around with stuff I found online. The script works and I see what you are saying about anyone being about to use it. I'm changing it right now to play around with it.
 
OK, the way it is now is how it was before I started messing with the asp stuff. The script acts like it works, but it never sends the email.
 
Back
Top