+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: How to send email based on drop-down selection?

  1. #1
    Join Date
    Jan 2006
    Posts
    6

    Default How to send email based on drop-down selection?

    My customers will fill out a form, and then send it to one of three distributution centers. My idea for selecting the email recipient is to put the distribution center email addresses in a drop-down list or in a radio button section.

    How can i grab the email address based on the selection and have the form mailed to that email address?

  2. #2
    Join Date
    Feb 2005
    Posts
    21

    Default Re: How to send email based on drop-down selection?

    I can't guarantee that this will work. But it is what I would try first.

    PHP Code:
    <form name="FORMMAIL">
    <
    select name="recipients" >
    <
    option selected value="email1_AtMangle_domain.com">Location1</option>
    <
    option value="email2_AtMangle_domain.com">Location 2</option>
    <
    option value="email3_AtMangle_domain.com">Location3</option>
    </
    select>
    </
    form

    _AtMangle_ would of course be the At Mangle you setup for formmail.php to hide the recipients true email from Email Harvesters. If you didn't specify one (you should consider it ) just use @ instead. Hope it works!
    Last edited by tyman00; 26-Jan-2006 at 03:55 PM.

  3. #3
    Join Date
    Jan 2006
    Posts
    6

    Default Re: How to send email based on drop-down selection?

    I understand the concept behind AtMangle (to protect against email harvesters), but my question is this:

    How do I set the TARGET_EMAIL to the drop-down selection?

    My code for the form includes this:
    <!-- STEP 2: Put your email address in the 'recipients' value.
    Note that you also have to allow this email address in the
    $TARGET_EMAIL setting within formmail.php!
    -->
    <input type="hidden" name="recipients" value="design@greenberginteractive.com" />

  4. #4
    Join Date
    Feb 2005
    Posts
    21

    Default Re: How to send email based on drop-down selection?

    Open formmail.php

    Go to about line: 2763 (Location of TARGET_EMAIL)


    This should be the code for that line:
    PHP Code:
    $TARGET_EMAIL = array(EMAIL_NAME."@yourDOMAIN\.com$"); 
    This will allow emails to be sent to any address in the actual domain. If you want to be more specific for security put the account name infront of the @ symbol. For more information there is a ton of information that is commented in the section just above the TARGET_EMAIL line. Besure you keep the \ before .com and the $ following .com. It is important, also documented in the comments in formmail.php.

    Then in your form (HTML file) just add the drop down list that I posted earlier.

    Edit: PS you might want to edit your previous post to remove your email so spam harvesters cant get them from this site either. Just use yourDomain.com for the example.
    Last edited by tyman00; 26-Jan-2006 at 09:15 PM.

  5. #5
    Join Date
    Jan 2006
    Posts
    6

    Default Re: How to send email based on drop-down selection?

    thanks for all your help so far.

    So what do I put in for the value in the following line in my form?
    <input type="hidden" name="recipients" value="?????" />

    Thanks,
    Carol

    p.s. I can't figure out how to edit an email in this forum

  6. #6
    Join Date
    Dec 2003
    Posts
    3,901

    Default Re: How to send email based on drop-down selection?

    Hi,

    Tyman's advice is completely correct.

    You leave out the "<input ... name="recipients" ..." field and replace it with the drop down (select) field as shown earlier.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  7. #7
    Join Date
    Jan 2006
    Posts
    6

    Default Re: How to send email based on drop-down selection?

    OK -- it's still not working. In my form, I have commented out the line:
    <input type="hidden" name="recipients" value="design_@_greenberginteractive.com" />


    My dropdown code in my form looks like this:
    <select name="recipients" size="1" class="bodycopy">
    <option selected="selected">Select a region...</option>
    <option value="cs101_@_greenberginteractive.com"">Western US,
    Cananda, Hawaii</option>
    <option value="<A href="mailto:cs101_@_greenberginteractive.com">Central">cs101_@_greenberginteractive.com">Central US, Canada</option>
    <option value="<A href="mailto:cs101_@_greenberginteractive.com">Eastern">cs101_@_greenberginteractive.com">Eastern US, Canada, Puerto Rico</option>
    <option value="<A href="mailto:cs101_@_greenberginteractive.com">Europe</option">cs101_@_greenberginteractive.com">Europe</option>
    <option value="<A href="mailto:cs101_@_greenberginteractive.com">Asia</option">cs101_@_greenberginteractive.com">Asia</option>
    </select>

    My formmail.php target email line looks like this:
    $TARGET_EMAIL = array(EMAIL_NAME."@greenberginteractive\.com$");

    I'm still not receiving the form emails. What is still wrong with the code?

  8. #8
    Join Date
    Dec 2003
    Posts
    3,901

    Default Re: How to send email based on drop-down selection?

    Hi,

    You have:
    <option value="<A href="mailto:cs101_@_greenberginteractive.com">Central">
    That's not what Tyman suggested. Your first option value is OK, the rest are wrong.

    You want:
    Code:
    <option value="email1">...
    <option value="email2">...
    <option value="email3">...
    No "<A>" tags, no "href", no "mailto".
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  9. #9
    Join Date
    Dec 2003
    Posts
    3,901

    Default Re: How to send email based on drop-down selection?

    Hi,

    I just realized that the forums probably added that junk when you pasted the email addresses.

    If your options are right, then when you say you commented out
    Code:
    <input type="hidden" name="recipients" value="design_@_greenberginteractive.com" />
    what precisely did you do?

    Can you post the URL for your form so we can take a look?
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  10. #10
    Join Date
    Feb 2005
    Posts
    21

    Default Re: How to send email based on drop-down selection?

    Quote Originally Posted by russellr
    Hi,

    I just realized that the forums probably added that junk when you pasted the email addresses.
    I had that same issue when I posted the example. Thats why I wrote it as an AtMangle example. It promoted that function at the same time, so it worked out well

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Multiple selection list
    By GrandpaRob73 in forum FormMail Subscription Support
    Replies: 2
    Last Post: 25-Jun-2004, 01:45 AM
  2. send an email in HTML
    By michecosta in forum FormMail Subscription Support
    Replies: 3
    Last Post: 25-May-2004, 09:18 PM
  3. William,Failed to send email.
    By shama07 in forum FormMail Subscription Support
    Replies: 1
    Last Post: 31-Jan-2004, 04:08 AM
  4. Help trying to set up a form to email and send info to file
    By rridsdale in forum FormMail Subscription Support
    Replies: 1
    Last Post: 14-Jan-2004, 03:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts