close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form sent to email address depending on option chosen

Thread began 8/18/2009 6:01 pm by MsEvette | Last modified 4/05/2010 11:59 am by Jason Byrnes | 6483 views | 11 replies |

MsEvette

Form sent to email address depending on option chosen

What's it going to take to set up my contact form with the following option? The recipient of the form needs to match up with the option chosen. For example, if the "service" option is chosen, the form needs to be emailed to the service department's email address. If "sales" is chosen, the form needs to be emailed to the sales department's email address...and so on. Somebody please tell me how this can be done.

Sign in to reply to this post

Jason ByrnesWebAssist

Create a select list where the values are the email addresses to send to:

html:
<select name="sendTo">
<option value="sales@domain.com">Sales</option>
<option value="service@domain.com">Service</option>
<option value="support@domain.com">support</option>
</select>



then on the contactus.php page, change line 37:

php:
$RecipientEmail = "".($WAGLOBAL_Contact_Email_To)  ."";include("WA_Universal_Email/WAUE_contact_1.php");



to:

php:
$RecipientEmail = "".(isset($_POST['sendTo'])?$_POST['sendTo']:"")  ."";include("WA_Universal_Email/WAUE_contact_1.php");
Sign in to reply to this post

MsEvette

One step further...bcc code needed.

Thank you for the option value code...it works great. I'd like to take this one step further and add a bcc to each option. Would you please be so kind and give me that code as well?

Sign in to reply to this post

Jason ByrnesWebAssist

create another selec t list:

<select name="ccTo">
<option value="sales@domain.com">Sales</option>
<option value="service@domain.com">Service</option>
<option value="support@domain.com">support</option>
</select>



and edit line 30 of the WA_Universal_Email/WAUE_contact_1.php file:

$WA_MailObject = WAUE_AddCC($WA_MailObject,"".($WAGLOBAL_Contact_Email_CC)  ."");



to:

$WA_MailObject = WAUE_AddCC($WA_MailObject,"".(isset($_POST['ccTo'])?$_POST['ccTo']:"")  ."");
Sign in to reply to this post

MsEvette

Thank you for your reply. Unfortunately, the second code you gave me doesn't do what I'm looking for, unless I just don't know what I'm doing. I want to "add a bcc to each option", not add another drop down menu/list in addition to the list I already have. Basically, if the sales department is sent an email because "sales" was chosen in the form, I want that same form to be blind courtesy copied to the general manager without the sales department knowing it was sent. Can this be done?

Sign in to reply to this post

Jason ByrnesWebAssist

Does the email need to be cc'd to the same GM email address regardless of which selection is made?

if not, what are the criteria to determine which address it should be sent to?



If it goes to the same address for each selection, just set the $WAGLOBAL_Contact_Email_BCC option in the WA_Globals.

If it goes to a different address, you will need to create an switch case statement like this:

php:
if(isset($_POST['sendTo']) && $_POST['sendTo'] != "") {

  switch($_POST['sendTo']) {
    case "sales@domain.com":
      $WA_MailObject = WAUE_AddBCC($WA_MailObject,"salesGM@domain.com");
      break;
    case "service@domain.com":
      $WA_MailObject = WAUE_AddBCC($WA_MailObject,"serviceGM@domain.com");    
      break;
    case "support@domain.com":
      $WA_MailObject = WAUE_AddBCC($WA_MailObject,"supportGM@domain.com");    
      break;
  }
}



just after the following line in the WA_Universal_Email/WAUE_contact_1.php file:

php:
$WA_MailObject = WAUE_AddBCC($WA_MailObject,"".($WAGLOBAL_Contact_Email_BCC)  ."");
Sign in to reply to this post

MsEvette

Great, thanks! Right now, each email is receiving a subject line that is coming from the WA_Globals file, and all emails have the same subject line. I need each email address to have its own unique subject line. Is this possible? And if so, would you be so kind as to reply with the proper code for this task?

Sign in to reply to this post

Jason ByrnesWebAssist

Same sort of switch case logic. in the WA_Universal_Email/WAUE_contact_1.php file, change:

php:
$MailSubject     = "".($WAGLOBAL_Contact_Email_Subject)  ."";




to:

php:
$MailSubject     = "Default Subject";


if(isset($_POST['sendTo']) && $_POST['sendTo'] != "") {
  switch($_POST['sendTo']) {
    case "sales@domain.com":
      $MailSubject     = "Sales Subject";
      break;
    case "service@domain.com":
      $MailSubject     = "Service Subject";   
      break;
    case "support@domain.com":
      $MailSubject     = "Support Subject"; 
      break;
  }
}
Sign in to reply to this post

MsEvette

Thank you for your excellent support. I now have my contact form set up exactly the way I need it.

Sign in to reply to this post

Jason ByrnesWebAssist

You're welcome.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...