Click to See Complete Forum and Search --> : Mail Form help


dtm32236
12-17-2007, 03:56 PM
Hi,

I have a email form with the following field:
<input type="hidden" name="To_Address" alt="To Address" value="SalesServices@foremostgroups.com">

then another with:
<input type="hidden" name="To_Address" alt="To Address" value="CustomerService@foremostgroups.com">

etc...

This allows me to use the same .asp script for several different email addresses:

Dim strTo, strFrom, strSubject, strComments, strSendName, strBodyText
strTo = request.form("To_Address")
strFrom = request.form("Email_Address")
strSubject = request.form("Subject")
strComments = request.form("Comments")
strSendName = request.form("Sender_Name")

strBodyText = "Name: " & strSendName & vbCrLf & vbCrLf
strBodyText = strBodyText & "Comments: " & strComments & vbCrLf

objMyMessage.To = strTo
objMyMessage.From = strFrom
objMyMessage.Subject = strSubject

objMyMessage.TEXTBody = strBodyText
objMyMessage.Send


Now, I'd like the email address to be invisible to everyone (in an effort to fight spam) so I'm thinking that I could do something like this:

<input type="hidden" name="To_Address" alt="To Address" value="sales">

then:

Dim strTo, strFrom, strSubject, strComments, strSendName, strBodyText
strToAddress = request.form("To_Address")
strFrom = request.form("Email_Address")
strSubject = request.form("Subject")
strComments = request.form("Comments")
strSendName = request.form("Sender_Name")

IF strToAddress = 'sales' THEN
strTo = 'SalesServices@foremostgroups.com'
END IF

IF strToAddress = 'cust_serv' THEN
strTo = 'CustomerService@foremostgroups.com'
END IF

...etc...

strBodyText = "Name: " & strSendName & vbCrLf & vbCrLf
strBodyText = strBodyText & "Comments: " & strComments & vbCrLf

objMyMessage.To = strTo
objMyMessage.From = strFrom
objMyMessage.Subject = strSubject

objMyMessage.TEXTBody = strBodyText
objMyMessage.Send


Would this work? Am I writing this with correct syntax? (probably not). I don't really know ASP, but this seems to make sense.

Thanks a lot for any help.

dtm32236
12-18-2007, 09:00 AM
anyone? is this how I would accomplish what I'm looking to do?

would this work?

dtm32236
12-18-2007, 02:34 PM
nevermind....

i got it (http://www.webdeveloper.com/forum/showthread.php?t=168892)