Forums

Send to Emails based on subjects

bradley568 13 May, 2009
Hi,

I started using ChronoForms and I'm still a bit of a novice. However, it looks quite powerful so hopefully it can help me achieve a solution to my problem.

Our website requires a Contact Us form. In this form, we have a subject that contains various Drop Down options. Depending on the option that is selected, I would like to be able to send the Contact Us to different email addresses.

For example:

Subject: Sponsor
Send to: [email]sponsors@mydomain.com[/email]

Subject: Supporter
Send to: [email]supporter@mydomain.com[/email]

If anyone knows of a way to set this up I'd appreciate your input.
GreyHead 13 May, 2009
Hi bradley568,

I think that FAQ 31 gives some simple examples of this - it's also been discussed in a couple of recent threads here.

Bob
bradley568 08 Jul, 2009
I tried to use FAQ 31 but it doesn't seem to work. It complains that it needs at least one recipient. looks like it isn't setting up an email address based on the selection.

Any suggestions?
GreyHead 08 Jul, 2009
Hi bradley568,

Please can you post the code you are using - the relevant bits of the Form Html and the OnSubmit code.

Bob
bradley568 10 Jul, 2009
Sure.

Form HTML:
<div class="form_item">
  <div class="form_element cf_heading">
    <h1 class="cf_text">Contact Us</h1>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Please complete the form and we will respond as quickly as possible.</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Full Name</label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_2" name="Name" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Email</label>
    <input class="cf_inputbox required validate-email" maxlength="150" size="30" title="" id="text_3" name="Email" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Subject</label>
    <select class="cf_inputbox" id="select_4" size="1" title=""  name="Subject">
    <option value="">Choose Option</option>
      <option value="Potential Players">Potential Players</option>
<option value="Sponsors">Sponsors</option>
<option value="7 Season">7 Season</option>
<option value="Merchandise">Merchandise</option>
<option value="Game Details">Game Details</option>
<option value="Match Reports">Match Reports</option>
<option value="Administration">Administration</option>
<option value="Recruitment">Recruitment</option>
<option value="Coaching">Coaching</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">Message</label>
    <textarea class="cf_inputbox required" rows="5" id="text_5" title="" cols="60" name="Message"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_6" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>

<select name="recipients">
  <option value="em1">Name 1</option>
  <option value="em2">Name 2</option>
  <option value="em3">Name 3</option>
</select>

OnSelect
<?php
$emails_2 = array('em1'=>'me@me.com', 'em2'=>'me@me.com', 'em3'=>'me@me.com');
 $emails[0]->to .= ','.$emails_2[$_POST['recipients']];
?>

My aim for this code was to be able to let them choose from my current select list (a list of contact topics) and then associate that with the an email address so that the question would be sent to a different email address depending on the subject.
This topic is locked and no more replies can be posted.