Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Multiple E-mail Form

Options
  • 05-03-2007 9:43pm
    #1
    Registered Users Posts: 1,583 ✭✭✭


    Anybody know of a contact form written in Php or other that will allow the message to be sent to a specific e-mail address depending on the selected subject?

    E.g.

    Name - Name of Contact

    Subject (Dropdown Box)

    If Sales selected then sales@mydomain.com
    If Info selected then info@mydomain.com
    If Technical Support selected then tsupport@mydomain.com
    You get the idea

    And then a submit button.

    If anybody has seen it in a website they may also post the links. I would prefer the written code as PHP is a complex language.

    Alan


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Should be straightforward.

    If you already have a mail script that expects an input tag for the to-address (i.e. "email_address" in the example below), just replace that with the select box, and set up the select box as follows:

    <select name="email_address">
    <option value="sales@mydomain.com">Sales</option>
    <option value="info@mydomain.com">Info</option>
    <option value="tsupport@mydomain.com">Technical Support</option>
    </select>

    If you need the PHP written from scratch, give me a shout via PM.


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    Liam Byrne wrote:
    Should be straightforward.

    If you already have a mail script that expects an input tag for the to-address (i.e. "email_address" in the example below), just replace that with the select box, and set up the select box as follows:

    <select name="email_address">
    <option value="sales@mydomain.com">Sales</option>
    <option value="info@mydomain.com">Info</option>
    <option value="tsupport@mydomain.com">Technical Support</option>
    </select>

    If you need the PHP written from scratch, give me a shout via PM.

    ok just have to say ouch ... have a think about what you're saying ... from a professional point of view you're just committing suicide ...

    if I input bob@bobland.com into your script then hey presto I've completely ****ed your site ... and can start mass spamming people using your contact form

    It'd be a lot better to .. lets say have your values as sales / info / support ...
    or whatever then based on this decide which email to use in your scripts ...

    never give the website the ability to do bad things with your contact forms

    Regards,
    James

    ps: ... I learned the hard way awhile back so don't take it personally ..


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    That would normally be a VERY valid point, James, but there are 3 things here:

    1) I posted this assuming the OP was looking for the form element and had a generic script - most of those scripts use hidden to fields for ease-of-use and/or have the anti-spam built-in (e.g. checking if the "to" address is to the same domain as the server that the form is on).

    If the OP had experience in editing server-side scripts, then yeah, I'd recommend a solution that reflected that.

    2) Having the email addresses in a select box, rather than in a text field (as used by the original formmail scripts before SPAM became such a problem) is actually more secure - if the referrer is checked by the script (or whatever other security mechanism), then there's no way anyone can enter bob@bobland.com

    3) Any form scripts I personally implement DON'T accept the to address from the form plus they have 7 or 8 server-side additional checks to avoid abuse - even for forms where the "to" address is specified. I would've specifed that in the reply above, but I didn't want to be seen to be flogging my services in that regard.

    Sorry if I seemed to imply otherwise.

    But yeah - TO THE OP - if you're using a variation of the above BE SURE THAT THE SCRIPT has at least one or two anti-SPAM mechanisms - checking the referrer, checking the target domain against the "to" address, checking the number of email addresses sent to it via to "address", checking the content, etc, etc.

    If in doubt, use a different form script, or get one written specifically for you.


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    The referrer can be spoofed though, I wouldn't rely on it too much.
    tbh while you're writing php for it, it'd be pretty trivial to write a quick switch into the form handler and avoid the whole messy email-in-form issue to begin with.
    Plus you don't have to reveal to the world which email addresses are set to receive the form... or that the form is being emailed at all.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    True - don't rely just on the referrer.

    And yeah, all fair points; if its an all-in-one script and you're familiar with PHP, make it as secure as possible to deter the scum of the web.


  • Advertisement
Advertisement