View Full Version : email contact box

06-21-2013, 03:46 PM
Few years ago I used a form from DD which allowed me to enter text area (name) text area (email) textarea Subject textearea (user input information) then a submit button to send the email to the person it named in email link which was in submit.

I am doing a website for holistic.co, at the moment I am just using a basic email linkin contact page but would like to create 3 contact areas in this page to be useful for each subject, with one being a sales content option thanks for any help

06-21-2013, 04:50 PM
I'm not sure I fully understand the question, but it sounds like you just want a contact form, and there are literally thousands of options available if you search for them. And it sounds like you want to allow multiple email addresses, which can be added to most of the forms in one way or another, assuming you know how to modify the code.

There are three components:
1. The HTML form. This part is easy. You just need the right fields (in the right layout) and a submit button. It may appear to "do something", but it doesn't. It's just an interface for part (2):

2. Serverside code that will receive the information and actually send it. There are actually three (quite different) options for this:
a) Don't do anything and instead use a "mailto:" type URL so that the user's default email program opens up with the contents of the message. This is the laziest and least impressive, and it also requires that they have a convenient default mail program available (and not everyone does-- I don't, for example).
b) Use a "free form mailer" (search for that term). That's an external website designed to handle exactly this. You'll have limited control but enough options to get it where it needs to go. It's very easy, and it's automatic (no extra step as in option (a) above). But usually there's either a limit or a fee or ads (for the sender and/or receiver). If you can live with some of those limitations, there are hundreds of options, so you can find the one that's right for you.
c) Create an emailing script yourself using a serverside language like PHP. (Or find a premade on that you can install on your server.) This isn't especially hard (relative to other things you could do with PHP for example), but it's not easy, and it requires familiarity with a serverside language (and that you have one available to you on your server). And again there are hundreds of tutorials for this.

3. The logic of how you work out who the email is sent to. Most forms have a single recipient, which makes things simple and allows you to hide the email address on the website (it's not displayed to the user) but still have it receive the message. You can either have the email address as part of the form data, or you can have it stored already serverside (or as part of the free form mailer's settings) so that it doesn't rely on what was sent by the user.
Be aware that if you allow user-submitted information (even if you suggest a default) for the email address in the form, your website can be used to send spam, so you will need to have some kind of filtering. Using a free form mailer would protect you from that a little bit, but your account/access to the free form mailer might be suspended if your website is being used to send lots of spam with it. Be aware that there is no restriction on the "from" or "to" address in email. That's just part of the message (at a technical level). So using the right code, I could send a message from you to you using what appears to be your email account! And there's nothing at all stopping me from doing that. I wouldn't receive the message or actually be able to access your account, but I could make it look like I did, by saying "from you" in the email. [You may have seen spam messages in your account like that too.]
Now, for that last reason, that's why allowing multiple email addresses can be problematic. It's not that you'll receive spam*, but that your website would be used to spam other people, unrelated to your website, and in a way you'd never know about. But there can be consequences.
So, there are two ways to allow multiple email addresses:
a) Use some kind of preset list, maybe with a dropdown. The form will allow "sales", "tech support" and "feedback" as options, then hidden from the user, on the server those will refer to actual different email addresses. This avoids the problem entirely (the one I was talking about above).
b) Allow the user to type in any email address they want (or, equivalently, use a real email address in the form, such as in a dropdown menu or hidden field-- those can be edited by someone who knows what they're doing, even if not by the average visitor to your website). Then the burden is on you to filter these on the server, which is no easy task. The simplest option would be to allow a preset list (stored on the server) that you match to what they typed, but ends up just being a complicated version of (a) in the end.
Either way, you can also have a default option in case something goes wrong, so that you could, for example, submit to admin@yoursite.com as needed.

(*As for you receiving spam, that can be a problem too, unrelated to all of this. A solution is to use a CAPTCHA if/when that becomes a problem. As needed, search for "CAPTCHA" and you'll find lots of information.)