PDA

View Full Version : Sending form data through email?


Andan
01-23-2008, 01:26 AM
Reference: http://www.grscgaming.com > inquiries

I want to have my website's form data automatically sent to my email address, but when I test it Outlook Express pops up instead.

I haven't done this in a few years. Anyone know what I'm forgetting?

jdrobinson
01-23-2008, 09:28 AM
I ran into the same problem, if the sendmail function is sending to an external address it won't work, apparently you need to send it to an internal address. I have setup a few forwards to handle it for me.

Andan
01-23-2008, 10:52 AM
That's the thing, I'm sending it a email account tied to my domain (aeneas@grscgaming.com).

I can't for the life of me find some of the older forms I did where I used a CGI app to process the form before sending it off.

JD,
What do you put in your form action attribute to get yours to work?
<form action""></form>

jdrobinson
01-23-2008, 11:38 AM
Well, I code my own sendmail using the PHP mail() function, so my form action looks something like this:

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"></form>

What you might want to do is download NMS-CGI Formmail, upload it to your cgi-bin, edit the @referer and @recipient parameters so that they say grscgaming.com and localhost. Change the sendmail parameter so it's /usr/sbin/sendmail -oi -t.

Then use this as your form action:

<form action="/cgi-bin/formmail.pl" method="post"></form>

Andan
01-23-2008, 05:40 PM
Hmm, thanks JD. I'll give that a try later in the week. :)

jdrobinson
01-24-2008, 11:48 AM
One thing I should mention is that you need to add this line to your form to actually make it send to your e-mail address:

<input type="hidden" name="recipient" value="aeneas@grscgaming.com" />