dave seah: better living through new media Filter Navigation Temporary Redirect Page Personal Articles Productivity Articles Compact Calendar The Printable CEO Series The Printable CEO Series Back to Home Page Admin:Login

WordPress Email Form Hack

POSTED 09/21/2004 UNDER Gweeping

UPDATE: You can download a much more useful plugin at from Ryan Duff's site: wp-contactform. There's also a version with more validation of the email address (through DNS, no less) called PXSMail, which I haven't tried.

My own contact page now uses wp-contactform...I hope my email contact woes go away now :-) For historical purposes, I'm leaving the old information up.

UPDATE: Use Ryan Duff's WP-ContactForm Plugin instead.

I decided not to put my contact address directly online, but my original instructions kinda sucked. So I modified the php email script at StarGeek to work for my contact page.

To make the basic form look like the rest of this site, I copied index.php as email.php and replaced everything in the content div with the contents of this text file

Instructions

Just replace with your email address, and this might work for you too. Use email.php for your email links, and this should work. The original script makes some assumptions about how sendmail is setup on your server, so you'll need to dig into it. I'm not a PHP or linux expert, so your mileage may vary.

The CSS class might not work for IE users though unless you are applying text-align:center in a containing DIV outside of this block, or so I'm told.

Other Notes

I also was reading about a built-in email validation function at ScriptyGoddess, so I put that in too.


Comments

1. brian said on 11/07/2004 05:34PM...

Hey Ive been trying to get your email script to work for a while now and ive gone through it pretty well but i keep getting and error near the end and im wondering if it has to do with my particular installation of php.

the error is this Parse error: parse error, unexpected T_VARIABLE in /home/brians6/public_html/jm/contact/contact_index.php(674) : eval()‘d code on line 2

any idea why it might be doing that?

i also go another errror on line 648 but i removed one set of the single quotes and it fixed but i cant seem to get around the other error.

thanks for your help!
——-

2. Dave said on 11/07/2004 11:49PM...

I had that problem when I first tried to get StarGeek’s script to work, so I changed it so it worked for me. It’s also possible that the Markdown processing is converting quotes into something “not good”, so I’ve put the code into a text file now. I’m not sure what “line 2” is for your code, or what line 674 has on it, so it’s hard to diagnose beyond that.

3. Loco Mote said on 02/14/2005 02:51AM...

I’m getting the parse error: “parse error, unexpected T_ENDFOREACH in /home/cotsford/public_html/locomote/email.php on line 121” 

Line 121 of my code for email.php is: ”<?php endforeach; else: ?>”

Any hints?  :)

Page 1 of 1 pages

Spam comments, especially search engine optimization linkbacks for products and services, are deleted on sight.

Name:

Email:

Location:

URL (about you):

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:


<< Back to main

Thank you for printing this article! Please note that all material on this website is copyrighted by either David Seah or individual comment contributors. To request permission for republication and distribution, please contact David Seah (http://davidseah.com/contact).