Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Closed Thread
Old 10-27-2010, 06:15 PM Can this be done
Extreme Talker

Posts: 238
Name: Patric
Trades: 0
So, I have a contact form set up, within it there are fields to go to an email address when pressed "submit"

In the form are dropdown menus for a selection, would it be possible to have the form set up so that when a field is selected, and then pressed "submit" it could then route to a specific email address that I have associated to each field?
Reckoner is offline
View Public Profile
 
 
Register now for full access!
Old 10-27-2010, 06:27 PM Re: Can this be done
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yes it can in any server side language (no need to cross post duplicate threads)
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 10-27-2010, 06:38 PM Re: Can this be done
Extreme Talker

Posts: 238
Name: Patric
Trades: 0
Phew.

Now comes the hard part, I realized that I should have posted this in the asp forum, but please bear with me.

I have the form set up in the following way:

1.) the HTML form

Code:
<p>Please complete the form below to contact us if you have any questions about our products or services.</p>
*Required:

<form action="Thank_You/Default.asp" id="thisform" method="post" name="thisform">
    <input id="subject" name="subject" type="hidden" value="Submission" />
    <input id="cheese" name="cheese" type="hidden" />
  <p>
        <label for="last name">First name *:</label>
        <br />
        <input class="required" rel="first name" id="first name" name="first name" type="text" />
  </p>
    <p>
      <label for="full name">Last name *:<br>
      </label>
    <input class="required" rel="last name" id="last name" name="last name" type="text" />
  </p>
    
    <p>
        <label for="email">Email Address *:</label>
        <br />
        <input class="required" rel="email" id="email" name="email" type="text" />
    </p>
    <p>
        <label for="phone">Phone Number *:</label>
        <br />
      <input class="required" rel="phone" id="phone" name="phone" type="text" />
    </p>
<p>
        <label for="phone">Title:</label>
        <br />
    <input id="title" rel="title"  name="Title" type="text" />
  </p>
  <p>
        <label for="interest">What can we help you with?</label>
        <br />
        <select id="interest" name="interest">
          <option></option>
          <option value="Request for Information">Request for Information</option>
          <option value="Request for Proposal">Request for Proposal</option>
          <option value="Purchasing / Accounting">Purchasing / Accounting</option>
          <option value="Customer Support">Customer Support</option>
          <option value="Other">Other</option>
        </select>
  </p>
  <p>
        <label for="company">Company:</label>
        <br />
        <input id="company" rel="company" name="company" type="text" />
    </p>
    <p>
        <label for="message">Message:</label>
        <br />
        <textarea cols="50" id="message" name="message" rows="10"></textarea>
    </p>
    <p>
        <input type="submit" value="Submit" />
    </p>
    
</form>
2.) the form goes to Thank_you/default.asp. Inside the page is the code that includes the following:
<%
dim emailto
emailto = "name@email.com"
%>

<!-- #include virtual="content/includes/formacceptor.asp" -->

how to I set it up so that the form then can transferred to an email address depending on the dropdown selection value in the form in step 1?

here is the code for the formacceptor.asp.
Code:
<%  
Set objMessage = CreateObject("CDO.Message") 
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="192.168.10.23"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25 
objMessage.Configuration.Fields.Update

objMessage.Subject = request.form("subject")
objMessage.Sender = "noreply@iongeo.com"
objMessage.To = emailto

dim body
body     = ""
for each field in Request.form
    if field <> "emailto" and field <> "cheese" and field <> "subject" then
        body = body & "<span style='text-transform:capitalize;  font-weight:bold;'>" & field & ":</span> " &  request.form(field)  & "<br>"
    end if
next 

objMessage.HTMLBody    = body

if request.form("cheese") = "" then
    objMessage.Send
end if

Set objMessage = nothing
%>

Please let me know if there is anything I can clarify on.

Thank you so much.

Last edited by Reckoner; 10-28-2010 at 10:59 AM..
Reckoner is offline
View Public Profile
 
Old 10-27-2010, 07:00 PM Re: Can this be done
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Do NOT put the email address in the form where it will be picked up by spam bots.

Just use the recipient name and append the hostname server side
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 10-27-2010, 08:24 PM Re: Can this be done
Extreme Talker

Posts: 238
Name: Patric
Trades: 0
Oh right, yeah that was mostly a test to see if it would simply work by adjusting the value="_" in the form field.

Can you please elaborate on:
Just use the recipient name and append the hostname server side

I'm not quite sure what you mean.
Reckoner is offline
View Public Profile
 
Old 10-27-2010, 08:43 PM Re: Can this be done
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
HTML Code:
<select name="recipient">
<option value="sales">Sales team</option>
<option value="hr">Human Resources</option>
<option value="purchasing">Purchasing</option>
<option value="accounts">Accounts</option>
</select>
Code:
<%
dim hostname: hostname = "domain.tld"
recipient = request.form("recipient") & "@" & hostname
' rest of mailing code
%>
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 10-28-2010, 11:31 AM Re: Can this be done
Extreme Talker

Posts: 238
Name: Patric
Trades: 0
HI Chris,

Thanks for your response, but I believe you were responding to the fact that I had the email addresses listed in the form, correct? I've modified my original post to reflect how the form is currently set up on our the site where the form behaves as it should and only sends to the address in the server side part of things.

However can you possibly provide some insight as to how I can just change the dim to go to specific email addresses that have been set up in the form? I'm still a little unclear about that.

Is the dim you provided supposed to be in addition to the one that I already have in place?, so that it would appear as:

Code:
<%
dim emailto
emailto = "name@email.com"
%>
<%
dim hostname: hostname = "domain.tld"
recipient = request.form("recipient") & "@" & hostname
'
%>

<!-- #include virtual="content/includes/formacceptor.asp" -->
When I try to just inlcude the form with the code you provided below, I get an error on line 23 of my formacceptor.asp file. Any ideas? If you could possibly provide any more insight, I would GREATLY appreciate it. My form is pretty much ready to go but I just need the dropdown to go to different email addresses.

Code:
<%
dim hostname: hostname = "domain.tld"
recipient = request.form("recipient") & "@" & hostname
' rest of mailing code
%>
Figured this out by modifying the formacceptor code quite a bit.

Last edited by Reckoner; 10-28-2010 at 03:00 PM..
Reckoner is offline
View Public Profile
 
Old 11-11-2010, 03:10 AM Re: Can this be done
Banned

Posts: 3
Trades: 0
Nice descriptions about contact form.
janita is offline
View Public Profile
 
Closed Thread     « Reply to Can this be done
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27578 seconds with 12 queries