PDA

View Full Version : Formmail probs


Mikey
01-23-2003, 11:44 PM
I'm attempting to set up formmail to send a message to subscribe to mailing list. From reading past posts and the readme file, I'm almost positive I've configured it correctly and installed it in the cgi-sys folder on my server, but i get the following error:

Sorry I can't send to domainname.com. Is domainname.com on this server ?

I'm sure its a simple error, but I'm not familiar with this type of code and getting a bit frustrated.

Thanks

don5408
01-24-2003, 12:09 AM
Hi. For help with this post back with the following:

(a) the exact code you are using in your form (or a link to the page containing the form)
(b) the "Define Variables" section of your FormMail.pl file (specifically what you currently have on the $mailprog, @referers and @recipients lines)

Don

Mikey
01-24-2003, 02:15 PM
Hey Don, thanks for the help!

Here is what I have for my form code:

<!--Mailing list layer information-->
<div id="mailinglist" valign="top"><FORM ACTION="/cgi-sys/FormMail.pl" METHOD="POST">
<INPUT TYPE="hidden" NAME="recipient"
VALUE="mailinglist-subscribe@mydomain.com">
<INPUT TYPE="hidden" NAME="required" VALUE="email">
<INPUT TYPE="text" NAME="email" SIZE="25">
<input type="image" name="Submit" value="Submit" src="submit.gif" border="0">
</FORM></div>

Here is what I have in my formmail.pl:

$mailprog = '/usr/sbin/sendmail -i -t';

@referers= 'mydomainname.com, mydomainip';

@recipients= '^mailinglist-subscribe@mydomain.com';

don5408
01-24-2003, 08:07 PM
"Here is what I have for my form code"

Hi. First of all at the risk of stating the obvious just to make 100% sure that we're on the same page...in the code above you're using the generic "mydomain.com" to indicate where you have entered the actual domain name associated with your HostRocket account, correct?

As far as the "I've configured it correctly and installed it in the cgi-sys folder on my server" note that "/cgi-sys/FormMail.pl" commonly refers to a copy of Matt Wright's FormMail script which HostRocket has preinstalled on it's servers in a central cgi-sys directory which is available to all accounts. Although the cgi-sys folder is setup such that the preinstalled scripts (FormMail, guestbook, counter etc) stored in the cgi-sys directory can be called from any account as if the cgi-sys directory *were* a subdirectory of public_html it's actually located elsewhere (/usr/local/cpanel/cgi-sys) and by default you wont actually see a folder by the name of cgi-sys on your account.

It appears to me from testing that if one creates a cgi-sys folder on their account, uploads their own local copy of FormMail.pl to it and then calls "/cgi-sys/FormMail.pl" in a form action (which is what I understand you did here) the script uploaded by the user will be ignored and the HR-installed script will be used.

Suggestions:

For starters if you have created a folder named "cgi-sys" as a subdirectory of public_html to avoid confusion I would delete that folder and everything within it.

After deleting the cgi-sys folder and getting back to square 1 as an initial test try this:

Create a file named mailform.html using the following exactly as is
with the exception of the value of the recipient line, where you would change "you@domain.com" to a valid email address you have created here on your HostRocket account (not an off-server email addy):

<FORM ACTION="/cgi-sys/FormMail.pl" METHOD="POST">
<INPUT TYPE="hidden" NAME="recipient" VALUE="you@domain.com">
<INPUT TYPE="hidden" NAME="required" VALUE="email">
<INPUT TYPE="text" NAME="email" SIZE="25">
<INPUT TYPE="submit" VALUE="Submit">
</FORM>

Upload the mailform.html file to your public_html folder (not to a subdirectory), load http://domain.com/mailform.html in your web browser and see if you successfully receive the output of the form via email.

If that works as designed (it should) you can try changing the email address to the subscribe address for your mailing list.

You are also likely going to want to go at least one step further by adding a redirect line pointing to a "thank you for subscribing" page. You'll note that with the simple form you are using after clicking Submit you will end up at a blank "Form Submission Results" page with no way to navigate back other than clicking the Back button on your browser.

To avoid having subscribers "dead ended" in this way you can upload a small file named thanks.html to your public_html folder containing a simple message such as "thank you for subscribing" and a link back to either the page containing your form or your main index page. In order to have users redirected to this page rather than the (empty) default confirmation page add the following line to your form:

<INPUT TYPE="hidden" NAME="redirect" VALUE="http://domain.com/thanks.html">

If you decide to add a redirect page in the end your form should look something like this:

<FORM ACTION="/cgi-sys/FormMail.pl" METHOD="POST">
<INPUT TYPE="hidden" NAME="recipient" VALUE="listname-subscribe@domain.com">
<INPUT TYPE="hidden" NAME="required" VALUE="email">
<INPUT TYPE="hidden" NAME="redirect" VALUE="http://domain.com/thanks.html">
<INPUT TYPE="text" NAME="email" SIZE="25">
<INPUT TYPE="submit" VALUE="Submit">
</FORM>

Note that as you are using the FormMail.pl file HR already has available for your use in the central cgi-sys folder in this scenario you do not have to modify and upload your own local copy of the FormMail script.

If you decide for whatever reason that you would PREFER to upload your own FormMail script you can do so. If you do:

1- Make SURE that you are using version 1.92 of FormMail
(versions earlier than v1.92 are insecure and can be exploited
by spammers)
2- Upload your FormMail.pl file to the cgi-bin (not cgi-sys) folder under public_html
3- Use <FORM ACTION="/cgi-bin/FormMail.pl" METHOD="POST"> in your form tag
4- Watch the syntax of your @referrers and @recipients variables

I don't know whether the problem was simply with your copying over to this thread or not however the @referrers and @recipients variables you posted above formatted as suggested. For the best results:

use @referers= ('mydomainname.com', 'mydomainip');
not @referers= 'mydomainname.com, mydomainip';

use @recipients= ('^mailinglist-subscribe\@mydomain\.com');
not @recipients= '^mailinglist-subscribe@mydomain.com';

Hope that helps!
Don

Mikey
01-24-2003, 09:11 PM
Makes sense. I have uploaded my own formmail into the cgi-sys folder on my domain so its probably just not recognizing it. I have been using my own domain in place of mydomainname.com ;) I'll make the changes you suggested and let you know how it goes, thanks much for the help!

Mikey
01-26-2003, 06:14 PM
I've reconfigured some things, but now am getting a 500 Internal server error.

Here is my html code
<div id="mailinglist" valign="top"><FORM ACTION="/cgi-bin/FormMail.pl" METHOD="POST">
<INPUT TYPE="hidden" NAME="recipient" VALUE="mikey@domain.com">
<INPUT TYPE="hidden" NAME="required" VALUE="email">
<INPUT TYPE="text" NAME="email" SIZE="25">
<INPUT TYPE="image" name="Submit" value="Submit" src="submit.gif" border="0">
</FORM></div>

Here is FormMail.pl which I have uploaded into the cgi-bin folder on my server.

$mailprog = '/usr/sbin/sendmail -i -t';
@referers = ('domain.com','domainip');
@recipients = ('^mikey@domain.com');

I tried doing this using HR's script and got something like this when I submitted the form and no email to my address:

emial sent
x=25
y=19

Thanks

don5408
01-27-2003, 08:15 AM
"I've reconfigured some things, but now am getting a 500 Internal server error."

Hi. Use your form again and immediately after getting the 500 error go to "Error Logs" in your HR Control Panel, copy the details of the error and post them here (these details can help identify the source of the problem).

"I tried doing this using HR's script and got something like this when I submitted the form and no email to my address:

emial sent
x=25
y=19"

That's pretty weird, I haven't a clue what that's about. As a test try uploading a file containing ONLY the following (change the email address to an address on your HR account, leave everything else exactly as is) as formtest.html to your public_html folder, try it and let us know what happens.

<FORM ACTION="/cgi-sys/FormMail.pl" METHOD="POST">
<INPUT TYPE="hidden" NAME="recipient" VALUE="you@domain.com">
<INPUT TYPE="text" NAME="email" SIZE="25">
<INPUT TYPE="submit" VALUE="Submit">
</FORM>

Don

Mikey
01-27-2003, 11:31 AM
Here is the error I got -

[2003-01-27 10:29:42]: error: file has no execute permission: (/home/underwo/public_html/cgi-bin/FormMail.pl)

Mikey
01-27-2003, 11:46 AM
ok the second part worked with the HR script but when i changed the address to mailinglist-subscribe@domain.com, I got no subscriber to the list? My mailing list address is mailinglist@domain.com. Any ideas here? Thanks much don

don5408
01-27-2003, 12:23 PM
"Here is the error I got - file has no execute permission"

Hi. You have to make the FormMail.pl file executible by setting the permissions to 755. This can be done in most FTP clients (check the online Help documentations for CHMOD details) or via the HR File Manager...browse to and click on the FormMail.pl file > Click "Change Permissions" and check the boxes as follows:
Mode User Group World
Read x x x
Write x
Execute x x x
Permission 7 5 5
"the second part worked with the HR script but when i changed the address to mailinglist-subscribe@domain.com, I got no subscriber to the list?"

Depending on how your list is setup the potential subscriber may have to confirm prior to being added to the list. When you email mailinglist-subscribe@domain.com directly what happens (is the email address you email from automatically added to the list, or...?)

Don

Mikey
01-27-2003, 01:51 PM
When I send an email in my mail client to mailinglist-subscribe@domain.com it automatically subscribes without confirmation, I've confirmed this, but when I do it through the form no subsription is made. I've checked/rechecked to make sure the recipient email in the form is correct, I don't what is wrong because we now know that I am able to send blank emails through the form?

don5408
01-27-2003, 09:08 PM
"when I do it through the form no subsription is made"

Hi. I tested this and got the same results. The problem there doesn't seem to be with your form or script, it looks to be a result of how FormMail handles return paths.

If you check the headers of the emailed output of your forms you'll notice that while they have the email address specified by the user via the form in the From: field of the email the return path used is nobody@host##.hrwebservices.net. I'm pretty sure that this is the reason why you are unable to successfully subscribe via a FormMail form.

Unfortunately it doesn't look like you'll be able to do exactly what you want to do here, at least not with FormMail as is without any modifications. Perhaps someone else here may have an alternate suggestion for you, and if you wish you can submit a trouble ticket explaining what you are looking to do to see if the HR staff can suggest a workaround. In the meantime while it's nowhere near as fancy a simple mailto tag should achieve the same results.

<a href="mailto:mailinglist-subscribe@domain.com">subscribe</a>

Best wishes
Don

Mikey
01-28-2003, 02:36 PM
Don, I'm trying to find a different script to do this with as I do not want to simply put a link and force users to send a blank message to me. I've looked around and found a script that relies on qmail thats sole purpose is submitting mail to ezmlm lists, so hopefuly that corrects the retrun path problem. Do we have qmail installed on HR servers and if so perhaps you could assist me in figuring out the qmail-inject path. Thanks

don5408
01-28-2003, 04:31 PM
Hi. Yes, the current email system in place here at HostRocket is qmail. I really don't have any knowledge of qmail other than what I've picked up about the end user options from working within QMailAdmin so unfortunately I'm not likely to be of much help as far as setting up the script you mention. Your best bet would probably be to ask the HR support staff about the possibility of using it via a trouble ticket (identify the script by name and include a link). Be sure to let them know exactly what you are looking to do, if using this particular script isn't possible perhaps they can suggest other alternatives.

Best o' luck!
Don