faqts : Computers : Programming : Languages : PHP : Common Problems : Email

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

40 of 86 people (47%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I create a simple PHP 'mail to' form?
How do I move from CGI to a PHP mailto form?

Nov 28th, 2006 14:39
jean korte, mike gifford, Nathan Wallace,


The link in the original answer is dead so I thought I'd modify the answer.
There is a tutorial at:
http://www.thesitewizard.com/archive/feedbackphp.shtml
that takes you step by step through the development of a simple feed
back form using php.  If you go through this tutorial, you will end up
with a simple form and will have some understanding of how it works.
I would like to caution that this very simple form, while it does work,
is very vulnerable to being abused by spammers.  
First of all, a spammer could very easily use this form to automatically
flood your email inbox with spam causing a problem both for you and for
your email service provider.  
Secondly, this form does not do enough input validation and so a spammer
could hijack it.  This means that the form could easily become an open
relay, used by a spammer to deliver messages to others -- stealing your
bandwidth to do it.  This would result in your domain and/or IP address
being banned by others.
It is really not that hard to do the input validation required to
prevent this but it does mean learning a bit more in order to know that
you have implemented it correctly.
I put a question and answer about this specific topic in this database
at the following link:
http://www.faqts.com/knowledge_base/entry/edit/index.phtml?aid=43317&fid=507&return_url=%2Fknowledge_base%2Fview.phtml%2Faid%2F43317%2Ffid%2F507
-------------------------------------------------------------------------
I have three examples of PHP3 Mailto Forms listed here with a more
detailed explaination for people who are new to PHP and just want to get
their forms up and running.  
http://www.openconcept.on.ca/guide-mail2form.phtml
I will be adding other simple forms in the future, written for a novice
web designer.
Mike