lrdchelp
asked on
How can I send results of ASP web form to multiple email addresses depending on responses?
I have a form which includes a question with 4 possible answers. I have no problem sending the email, but I want it to go to defferent people depending on the response.
I am still a newbie and assume I would want to use some sort of filter, but do not know how to implement this.
I am still a newbie and assume I would want to use some sort of filter, but do not know how to implement this.
ASKER
Thanks so much.
I am using CDO but through a Dreamweaver extension that codes it for you. This is making it more complicated as I'm not sure where in the page to add this. I am adding the code with the hope that you may be able to help me figure out where to put the above info.
I am using CDO but through a Dreamweaver extension that codes it for you. This is making it more complicated as I'm not sure where in the page to add this. I am adding the code with the hope that you may be able to help me figure out where to put the above info.
<%
' NOTE: There are a lot of configuration parameters in this fist section. Please read the
' comments located before each configuration parameters. Be sure to keep a copy of
' the original file before changing anything.
'*************************************************************************************************
'** Possible values are "CDOSYS", "CDONTS", "ASPEmail", "ASPMail", "Jmail" ' line #5 *
'*************************************************************************************************
Const C_MAIL_USE = "CDOSYS"
'*************************************************************************************************
'** If your email server is not your web server, then enter the address in the following line *
'** Note for Godaddy users: The mail server is "relay-hosting.secureserver.net" *
'** Note for 1and1.com users: The mail server is "mrelay.perfora.net" *
'** Note for 1and1.co.uk and 1and1.de users: The mail server is "mrvnet.kundenserver.de" *
'*************************************************************************************************
Const SMTP_SERVER = "smtp.pitt.edu"
'*************************************************************************************************
'** Authentication required? If yes, specify username and password *
'*************************************************************************************************
Const HDW_USE_AUTHENTICATION = False
Const HDW_AUTH_USERNAME = ""
Const HDW_AUTH_PASSWORD = ""
'*************************************************************************************************
'** send CC to another emails, separated by semicolon, *
'** example: Const HDW_SEND_CC_TO = "email-1@domain.com;email-2@domain.com" *
'*************************************************************************************************
Const HDW_SEND_CC_TO = "krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
'*************************************************************************************************
'** send CC to the user with a "Thank you message" *
'** If enabled you MUST specify the name of the user's email field in the form *
'*************************************************************************************************
Const HDW_SEND_THANKYOU = False
Const HDW_USER_EMAIL_FIELD_NAME = "email"
Const HDW_INCLUDE_SUBMITTED_DATA = False
Const HDW_THANKYOU_SUBJECT = "Thank you for your message."
Const HDW_THANKYOU_MSG = "Thank you for your message. We will reply you as soon as possible."
'*************************************************************************************************
'** Email subject, you can change it here *
'*************************************************************************************************
Dim emailsubject
emailsubject= "Room Reservation Request"
'*************************************************************************************************
'** Use the email and/or subject entered by the user as FROM/SUBJECT. *
'** IMPORTANT!!! You need to specify the name of the email/subject fields in your form. *
'*************************************************************************************************
Const HDW_FROM_EMAIL_FIELD_NAME = "email"
Const HDW_SUBJECT_FIELD_NAME = "subject"
'*************************************************************************************************
'** Exclude fields, add one AddExcludedField call for each excluded field *
'*************************************************************************************************
Dim excluded_fields(100), excluded_fields_count : excluded_fields_count = 0
AddExcludedField "submit"
AddExcludedField "Submit"
AddExcludedField "hdcaptcha"
AddExcludedField "hdwfail"
AddExcludedField "sample_excluded_field"
'*************************************************************************************************
'** Fix destination email. This helps to increate the form security *
'** Example: Const HDW_FIX_DESTINATION_EMAIL = "email@sample.com" *
'*************************************************************************************************
Const HDW_FIX_DESTINATION_EMAIL = ""
'*************************************************************************************************
'** Set this param to true to resend the info as GET parameters to the "Thank You" page. *
'*************************************************************************************************
Const HDW_ENABLE_DEBUG_MESSAGES = False
'*************************************************************************************************
'** Set this param to true to resend the info as GET parameters to the "Thank You" page. *
'*************************************************************************************************
Const HOTDW_RESEND_PARAMS = False
'*************************************************************************************************
'** Use plain text instead HTML emails. This helps to prevent spam filters. *
'*************************************************************************************************
Const USE_PLAIN_TEXT_EMAILS = False
'*************************************************************************************************
'** Some antivirus prevent the filesystem object. In that case you can disable it. *
'*************************************************************************************************
Const USE_FILESYSTEM_OBJECT = True
%>
<!--METADATA TYPE="typelib"
UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library"
-->
<%
Server.ScriptTimeout = 1000000000
Response.Expires = 0
Response.Buffer = True
Const SMTP_PORT = 25
Const HDW_F2M_EMAIL = "hdwemail"
Const HDW_F2M_OK = "hdwok"
Const HDW_F2M_NO_OK = "hdwnook"
Dim localpath
localpath = Server.MapPath("Form2Mail.asp.mdb")
localpath = Left(localpath, Len(localpath)-Len("Form2Mail.asp.mdb") )
Dim fso, MyFile
Dim Attachments, globalbuffer
Attachments = False ' Do not modify this
Function getCountryID(ip)
Dim cip
cip = IPAddress2IPNumber(ip)
On Error Resume Next
Dim conn, index, rs
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Form2Mail.asp.mdb") & ";Persist Security Info=False")
Set rs = conn.Execute("SELECT country FROM iptocountry WHERE ip1<="&cip&" AND ip2>="&cip)
If rs.EOF Then getCountryID = "LOCAL, INTRANET OR UNKNOWN" Else getCountryID = countryname(rs.Fields.Item("country"))
End Function
Function IPAddress2IPNumber(IPaddress)
Dim i, pos, PrevPos, num
If IPaddress = "" Then
IPAddress2IPNumber = 0
Else
For i = 1 To 4
pos = InStr(PrevPos + 1, IPaddress, ".", 1)
If i = 4 Then pos = Len(IPaddress) + 1
num = Int(Mid(IPaddress, PrevPos + 1, pos - PrevPos - 1))
PrevPos = pos
IPAddress2IPNumber = ((num Mod 256) * (256 ^ (4 - i))) + IPAddress2IPNumber
Next
End If
End Function
Function ereg(find,str)
if Instr(1, str, find, 1) <> 0 Then
ereg = True
Else
ereg = False
End If
End Function
Function ckbrowser(user_agent)
Dim browser
if((ereg("Netscape", user_agent))) Then
browser = "Netscape"
elseif(ereg("Firefox", user_agent)) Then
browser = "Firefox"
elseif(ereg("Safari", user_agent)) Then
browser = "Safari"
elseif(ereg("SAFARI", user_agent)) Then
browser = "SAFARI"
elseif(ereg("MSIE", user_agent)) Then
browser = "MSIE"
elseif(ereg("Lynx", user_agent)) Then
browser = "Lynx"
elseif(ereg("Opera", user_agent)) Then
browser = "Opera"
elseif(ereg("Gecko", user_agent)) Then
browser = "Mozilla"
elseif(ereg("WebTV", user_agent)) Then
browser = "WebTV"
elseif(ereg("Konqueror", user_agent)) Then
browser = "Konqueror"
else
browser = "bot"
End If
ckbrowser = browser
End Function
' country list
Dim countryname(212)
countryname(0) = "UNKNOWN" : countryname(1) = "AFGHANISTAN"
countryname(2) = "ALBANIA" : countryname(3) = "ALGERIA"
countryname(4) = "AMERICAN SAMOA" : countryname(5) = "ANDORRA"
countryname(6) = "ANGOLA" : countryname(7) = "ANTIGUA AND BARBUDA"
countryname(8) = "ARGENTINA" : countryname(9) = "ARMENIA"
countryname(10) = "AUSTRALIA": countryname(11) = "AUSTRIA"
countryname(12) = "AZERBAIJAN" : countryname(13) = "BAHAMAS"
countryname(14) = "BAHRAIN" : countryname(15) = "BANGLADESH"
countryname(16) = "BARBADOS" : countryname(17) = "BELARUS"
countryname(18) = "BELGIUM" : countryname(19) = "BELIZE"
countryname(20) = "BENIN" : countryname(21) = "BERMUDA"
countryname(22) = "BHUTAN"
countryname(23) = "BOLIVIA"
countryname(24) = "BOSNIA AND HERZEGOVINA"
countryname(25) = "BOTSWANA"
countryname(26) = "BRAZIL"
countryname(27) = "BRITISH INDIAN OCEAN TERRITORY"
countryname(28) = "BRUNEI DARUSSALAM"
countryname(29) = "BULGARIA"
countryname(30) = "BURKINA FASO"
countryname(31) = "BURUNDI"
countryname(32) = "CAMBODIA"
countryname(33) = "CAMEROON"
countryname(34) = "CANADA"
countryname(35) = "CAPE VERDE"
countryname(36) = "CAYMAN ISLANDS"
countryname(37) = "CENTRAL AFRICAN REPUBLIC"
countryname(38) = "CHAD"
countryname(39) = "CHILE"
countryname(40) = "CHINA"
countryname(41) = "COLOMBIA"
countryname(42) = "COMOROS"
countryname(43) = "CONGO"
countryname(44) = "COOK ISLANDS"
countryname(45) = "COSTA RICA"
countryname(46) = "COTE D""IVOIRE"
countryname(47) = "CROATIA"
countryname(48) = "CUBA"
countryname(49) = "CYPRUS"
countryname(50) = "CZECH REPUBLIC"
countryname(51) = "DENMARK"
countryname(52) = "DJIBOUTI"
countryname(53) = "DOMINICAN REPUBLIC"
countryname(54) = "EAST TIMOR"
countryname(55) = "ECUADOR"
countryname(56) = "EGYPT"
countryname(57) = "EL SALVADOR"
countryname(58) = "EQUATORIAL GUINEA"
countryname(59) = "ERITREA"
countryname(60) = "ESTONIA"
countryname(61) = "ETHIOPIA"
countryname(62) = "FALKLAND ISLANDS (MALVINAS)"
countryname(63) = "FAROE ISLANDS"
countryname(64) = "FIJI"
countryname(65) = "FINLAND"
countryname(66) = "FRANCE"
countryname(67) = "FRENCH POLYNESIA"
countryname(68) = "GABON"
countryname(69) = "GAMBIA"
countryname(70) = "GEORGIA"
countryname(71) = "GERMANY"
countryname(72) = "GHANA"
countryname(73) = "GIBRALTAR"
countryname(74) = "GREECE"
countryname(75) = "GREENLAND"
countryname(76) = "GRENADA"
countryname(77) = "GUADELOUPE"
countryname(78) = "GUAM"
countryname(79) = "GUATEMALA"
countryname(80) = "GUINEA"
countryname(81) = "GUINEA-BISSAU"
countryname(82) = "HAITI"
countryname(83) = "HOLY SEE(VATICAN CITY STATE)"
countryname(84) = "HONDURAS"
countryname(85) = "HONG KONG"
countryname(86) = "HUNGARY"
countryname(87) = "ICELAND"
countryname(88) = "INDIA"
countryname(89) = "INDONESIA"
countryname(90) = "IRAQ"
countryname(91) = "IRELAND"
countryname(92) = "ISLAMIC REPUBLIC OF IRAN"
countryname(93) = "ISRAEL"
countryname(94) = "ITALY"
countryname(95) = "JAMAICA"
countryname(96) = "JAPAN"
countryname(97) = "JORDAN"
countryname(98) = "KAZAKHSTAN"
countryname(99) = "KENYA"
countryname(100) = "KIRIBATI"
countryname(101) = "KUWAIT"
countryname(102) = "KYRGYZSTAN"
countryname(103) = "LAO PEOPLE""S DEMOCRATIC REPUBLIC"
countryname(104) = "LATVIA"
countryname(105) = "LEBANON"
countryname(106) = "LESOTHO"
countryname(107) = "LIBERIA"
countryname(108) = "LIBYAN ARAB JAMAHIRIYA"
countryname(109) = "LIECHTENSTEIN"
countryname(110) = "LITHUANIA"
countryname(111) = "LUXEMBOURG"
countryname(112) = "MACAO"
countryname(113) = "MADAGASCAR"
countryname(114) = "MALAWI"
countryname(115) = "MALAYSIA"
countryname(116) = "MALDIVES"
countryname(117) = "MALI"
countryname(118) = "MALTA"
countryname(119) = "MARTINIQUE"
countryname(120) = "MAURITANIA"
countryname(121) = "MAURITIUS"
countryname(122) = "MEXICO"
countryname(123) = "MONACO"
countryname(124) = "MONGOLIA"
countryname(125) = "MOROCCO"
countryname(126) = "MOZAMBIQUE"
countryname(127) = "MYANMAR"
countryname(128) = "NAMIBIA"
countryname(129) = "NAURU"
countryname(130) = "NEPAL"
countryname(131) = "NETHERLANDS"
countryname(132) = "NETHERLANDS ANTILLES"
countryname(133) = "NEW CALEDONIA"
countryname(134) = "NEW ZEALAND"
countryname(135) = "NICARAGUA"
countryname(136) = "NIGER"
countryname(137) = "NIGERIA"
countryname(138) = "NORTHERN MARIANA ISLANDS"
countryname(139) = "NORWAY"
countryname(140) = "OMAN"
countryname(141) = "PAKISTAN"
countryname(142) = "PALAU"
countryname(143) = "PALESTINIAN TERRITORY"
countryname(144) = "PANAMA"
countryname(145) = "PAPUA NEW GUINEA"
countryname(146) = "PARAGUAY"
countryname(147) = "PERU"
countryname(148) = "PHILIPPINES"
countryname(149) = "POLAND"
countryname(150) = "PORTUGAL"
countryname(151) = "PUERTO RICO"
countryname(152) = "QATAR"
countryname(153) = "REPUBLIC OF KOREA"
countryname(154) = "REPUBLIC OF MOLDOVA"
countryname(155) = "REUNION"
countryname(156) = "ROMANIA"
countryname(157) = "RUSSIAN FEDERATION"
countryname(158) = "RWANDA"
countryname(159) = "SAMOA"
countryname(160) = "SAN MARINO"
countryname(161) = "SAO TOME AND PRINCIPE"
countryname(162) = "SAUDI ARABIA"
countryname(163) = "SENEGAL"
countryname(165) = "SERBIA AND MONTENEGRO"
countryname(166) = "SEYCHELLES"
countryname(167) = "SIERRA LEONE"
countryname(168) = "SINGAPORE"
countryname(169) = "SLOVAKIA"
countryname(170) = "SLOVENIA"
countryname(171) = "SOLOMON ISLANDS"
countryname(172) = "SOMALIA"
countryname(173) = "SOUTH AFRICA"
countryname(174) = "SPAIN"
countryname(175) = "SRI LANKA"
countryname(176) = "SUDAN"
countryname(177) = "SURINAME"
countryname(178) = "SWAZILAND"
countryname(179) = "SWEDEN"
countryname(180) = "SWITZERLAND"
countryname(181) = "SYRIAN ARAB REPUBLIC"
countryname(182) = "TAIWAN"
countryname(183) = "TAJIKISTAN"
countryname(184) = "THAILAND"
countryname(185) = "THE DEMOCRATIC REPUBLIC OF THE CONGO"
countryname(186) = "THE FORMER YUGOSLAV REPUBLIC OF MACEDONIA"
countryname(187) = "TOGO"
countryname(188) = "TOKELAU"
countryname(189) = "TONGA"
countryname(190) = "TRINIDAD AND TOBAGO"
countryname(191) = "TUNISIA"
countryname(192) = "TURKEY"
countryname(193) = "TURKMENISTAN"
countryname(194) = "TUVALU"
countryname(195) = "UGANDA"
countryname(196) = "UKRAINE"
countryname(197) = "UNITED ARAB EMIRATES"
countryname(198) = "UNITED KINGDOM"
countryname(199) = "UNITED REPUBLIC OF TANZANIA"
countryname(200) = "UNITED STATES"
countryname(201) = "URUGUAY"
countryname(202) = "UZBEKISTAN"
countryname(203) = "VANUATU"
countryname(204) = "VENEZUELA"
countryname(205) = "VIET NAM"
countryname(206) = "VIRGIN ISLANDS"
countryname(207) = "WESTERN SAHARA"
countryname(208) = "YEMEN"
countryname(209) = "ZAMBIA"
countryname(210) = "ZIMBABWE"
Sub AddExcludedField(value)
excluded_fields_count = excluded_fields_count + 1
excluded_fields(excluded_fields_count) = value
End Sub
Function notInThisArray(value)
Dim i, found
found = False
For i = 1 To excluded_fields_count
If (excluded_fields(i)=value) Then found = True
Next
notInThisArray = Not found
End Function
Dim emailaddress, fromaddress, body, item, getStr
body ="<strong>SUBMITTED INFORMATION</strong><br />" &_
"<strong>***************************</strong><br />"
getStr = ""
If (InStr(1,Request.ServerVariables("CONTENT_TYPE"), "multipart/form-data", 1) <= 0) Then
Dim name
for i = 1 to Request.Form.Count
for each name in Request.Form
if Request.Form(name) is Request.Form(i) AND (name <> HDW_F2M_OK) And (name <> HDW_F2M_NO_OK) And (name <> HDW_F2M_EMAIL) And notInThisArray(name) then
body = body & "<strong>"&name&":</strong> "&Request.Form(name)&"<br /><br />"
getStr = getStr & "&"&name&"="&Server.URLEncode(Request.Form(name))
end if
next
next
for i = 1 to Request.QueryString.Count
for each name in Request.QueryString
if Request.QueryString(name) is Request.QueryString(i) AND (name <> HDW_F2M_OK) And (name <> HDW_F2M_NO_OK) And (name <> HDW_F2M_EMAIL) And notInThisArray(name) then
body = body & "<strong>"&name&":</strong> "&Request.QueryString(name)&"<br /><br />"
getStr = getStr & "&"&name&"="&Server.URLEncode(Request.QueryString(name))
end if
next
next
emailaddress = Replace(Request(HDW_F2M_EMAIL),"+","@")
If HDW_FIX_DESTINATION_EMAIL <> "" Then emailaddress = HDW_FIX_DESTINATION_EMAIL
fromaddress = emailaddress
If (HDW_FROM_EMAIL_FIELD_NAME <> "") Then fromaddress = Request(HDW_FROM_EMAIL_FIELD_NAME)
If (HDW_SUBJECT_FIELD_NAME <> "") Then emailsubject = Request(HDW_SUBJECT_FIELD_NAME)
Else
Dim UploadRequest, byteCount, RequestBin, keys, i
Set UploadRequest = CreateObject("Scripting.Dictionary")
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
BuildUploadRequest RequestBin
Attachments = True
keys = UploadRequest.Keys
For i = 0 To UploadRequest.Count -1
If Not (UploadRequest.Item(keys(i)).Exists("FileName")) Then
If (keys(i) <> HDW_F2M_OK) And (keys(i) <> HDW_F2M_NO_OK) And (keys(i) <> HDW_F2M_EMAIL) And notInThisArray(keys(i)) Then
body = body & "<strong>"&keys(i)&":</strong> "&UploadRequest.Item(keys(i)).Item("Value")&"<br /><br />"
getStr = getStr & "&"&keys(i)&"="&Server.URLEncode(UploadRequest.Item(keys(i)).Item("Value"))
End If
Else
If notInThisArray(keys(i)) Then
body = body & "<strong>"&keys(i)&":</strong> "&UploadRequest.Item(keys(i)).Item("FileName")&"<br /><br />"
getStr = getStr & "&"&keys(i)&"="&Server.URLEncode(UploadRequest.Item(keys(i)).Item("FileName"))
End If
End If
Next
emailaddress = UploadRequest.Item(HDW_F2M_EMAIL).Item("Value")
emailaddress = Replace(emailaddress,"+","@")
If HDW_FIX_DESTINATION_EMAIL <> "" Then emailaddress = HDW_FIX_DESTINATION_EMAIL
fromaddress = emailaddress
If (HDW_FROM_EMAIL_FIELD_NAME <> "") Then fromaddress = UploadRequest.Item(HDW_FROM_EMAIL_FIELD_NAME).Item("Value")
If (HDW_SUBJECT_FIELD_NAME <> "") Then emailsubject = UploadRequest.Item(HDW_SUBJECT_FIELD_NAME).Item("Value")
End If
getStr = "hdw=1" & getStr
body = body & "<strong>SUPPORT INFORMATION</strong><br />" &_
"<strong>***************************</strong><br />" &_
"<strong>Country:</strong> " &getCountryID(Request.ServerVariables("REMOTE_HOST"))&"<br />" &_
"<strong>User IP:</strong> "&Request.ServerVariables("REMOTE_ADDR")&"<br />" &_
"<strong>User Host:</strong> "&Request.ServerVariables("REMOTE_HOST")&"<br />" &_
"<strong>Referer:</strong> "&Request.ServerVariables("HTTP_REFERER")&"<br />" &_
"<strong>Server Time:</strong> "&Date & " "& Time&"<br />" &_
"<strong>Browser:</strong> "&ckbrowser(Request.ServerVariables("HTTP_USER_AGENT"))&"<br />" &_
"<strong>User Agent:</strong> "&Request.ServerVariables("HTTP_USER_AGENT")&"<br /><br />" &_
"<hr />Delivered by HotDreamweaver Form2Mail Script"
If (USE_PLAIN_TEXT_EMAILS) Or (C_MAIL_USE = "ASPMail") Then
body = Replace(body,"<strong>","")
body = Replace(body,"</strong>","")
body = Replace(body,"<br />", vbNewLine)
body = Replace(body,"<hr />","___________________________" & vbNewLine)
End If
If HDW_SEND_THANKYOU Then
Dim thk_msg, thk_email
thk_msg = HDW_THANKYOU_MSG
If HDW_INCLUDE_SUBMITTED_DATA Then thk_msg = thk_msg & "<br /><br />" & body
If Not Attachments Then thk_email = Request.Form(HDW_USER_EMAIL_FIELD_NAME) Else thk_email = UploadRequest.Item(HDW_USER_EMAIL_FIELD_NAME).Item("Value")
If (thk_email = fromaddress) Then
SendMail thk_email,emailaddress,HDW_THANKYOU_SUBJECT,thk_msg,HDW_INCLUDE_SUBMITTED_DATA
Else
SendMail thk_email,fromaddress,HDW_THANKYOU_SUBJECT,thk_msg,HDW_INCLUDE_SUBMITTED_DATA
End If
End If
If Attachments Then
If (InStr(UploadRequest.Item(HDW_F2M_OK).Item("Value"),"?") > 0) And (getStr <> "") Then getStr = "&" & getStr Else getStr = "?" & getStr
If Not HOTDW_RESEND_PARAMS Then getStr = ""
If (SendMail(emailaddress, fromaddress, emailsubject, body, True)) Then
Response.Redirect UploadRequest.Item(HDW_F2M_OK).Item("Value") & getStr
Else
Response.Redirect UploadRequest.Item(HDW_F2M_NO_OK).Item("Value")
End If
Else
If (InStr(Request(HDW_F2M_OK),"?") > 0) And (getStr <> "") Then getStr = "&" & getStr Else getStr = "?" & getStr
If Not HOTDW_RESEND_PARAMS Then getStr = ""
If (SendMail(emailaddress, fromaddress, emailsubject, body, True)) Then
Response.Redirect Request(HDW_F2M_OK) & getStr
Else
Response.Redirect Request(HDW_F2M_NO_OK)
End If
End If
%><%
Function SendMail (var_ToAddress, var_FromAddress, var_Subject, var_Message, var_FlagAttachments)
Dim smtp, objMail, i, j, value, iBp, Flds, Binary
Dim objStream
Dim Stm
Dim buffer
' Send the email
If C_MAIL_USE = "CDOSYS" Then
Set objMail = Server.CreateObject("CDO.Message")
'objMail.MailFormat = 1
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_SERVER
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTP_PORT
If HDW_USE_AUTHENTICATION Then
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = HDW_AUTH_USERNAME
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = HDW_AUTH_PASSWORD
End If
objMail.Configuration.Fields.Update
objMail.To = var_ToAddress
objMail.From = var_FromAddress
objMail.Subject = var_Subject
If Not USE_PLAIN_TEXT_EMAILS Then
objMail.HTMLBody = var_Message
Else
objMail.TextBody = var_Message
End If
If (HDW_SEND_CC_TO <> "") Then objMail.CC = HDW_SEND_CC_TO
If Attachments And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
Set iBp = objMail.Attachments.Add
Set Flds = iBp.Fields
With Flds
.Item("urn:schemas:mailheader:content-type") = "binary; name="&UploadRequest.Item(keys(i)).Item("FileName")
.Item("urn:schemas:mailheader:content-transfer-encoding") = "base64"
.Update
End With
Set Stm = iBp.GetDecodedContentStream
Set value = UploadRequest.Item(keys(i)).Item("Value")
On Error Resume Next
Stm.Write (value.Read)
value.Position = 0
Stm.Flush
Set Stm = Nothing
End If
Next
End If
On Error Resume Next
objMail.Send
Set objMail = Nothing
If Err.Number = 0 Then SendMail = True
If (Err.Number <> 0) And (HDW_ENABLE_DEBUG_MESSAGES) Then
Response.Write Err.Description
Response.End
End If
End If
If (C_MAIL_USE = "CDONTS") Or ((C_MAIL_USE = "CDOSYS") AND (Err.Number <> 0)) Then
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.MailFormat = 0
If Not USE_PLAIN_TEXT_EMAILS Then
objMail.BodyFormat = 0
Else
objMail.BodyFormat = 1
End If
objMail.To = var_ToAddress
If (HDW_SEND_CC_TO <> "") Then objMail.CC = HDW_SEND_CC_TO
objMail.From = var_FromAddress
objMail.Subject = var_Subject
objMail.Body = var_Message
Err.Clear
If Attachments And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
UploadRequest.Item(keys(i)).Item("Value").saveToFile (localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName"))
objMail.AttachFile localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName"), UploadRequest.Item(keys(i)).Item("FileName")
End If
Next
End If
objMail.Send
Set objMail = Nothing
If Err.Number = 0 Then SendMail = True Else SendMail = False
If (Err.Number <> 0) And (HDW_ENABLE_DEBUG_MESSAGES) Then
Response.Write Err.Description
Response.End
End If
If (Attachments) And (USE_FILESYSTEM_OBJECT) And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.GetFile( localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName") )
MyFile.Delete
End If
Next
End If
ElseIf (C_MAIL_USE = "ASPEmail") Then
Set objMail = Server.CreateObject("Persits.MailSender")
objMail.Host = SMTP_SERVER
objMail.From = var_FromAddress
objMail.FromName = var_FromAddress
objMail.AddAddress var_ToAddress, var_ToAddress
If HDW_USE_AUTHENTICATION Then
objMail.Username = HDW_AUTH_USERNAME
objMail.Password = HDW_AUTH_PASSWORD
End If
If Attachments And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
UploadRequest.Item(keys(i)).Item("Value").saveToFile (localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName"))
objMail.AddAttachment localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName")
End If
Next
End If
If (HDW_SEND_CC_TO <> "") Then objMail.AddCC HDW_SEND_CC_TO
objMail.Subject = var_Subject
objMail.Body = var_Message
objMail.IsHTML = Not USE_PLAIN_TEXT_EMAILS
objMail.Send
If (Attachments) And (USE_FILESYSTEM_OBJECT) And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.GetFile( localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName") )
MyFile.Delete
End If
Next
End If
SendMail = True
ElseIf (C_MAIL_USE = "ASPMail") Then
set objMail = Server.CreateObject("SMTPsvg.Mailer")
objMail.RemoteHost = SMTP_SERVER
objMail.FromAddress = var_FromAddress
objMail.FromName = var_FromAddress
objMail.AddRecipient var_ToAddress, var_ToAddress
If (HDW_SEND_CC_TO <> "") Then objMail.AddCC HDW_SEND_CC_TO, HDW_SEND_CC_TO
If Attachments And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
UploadRequest.Item(keys(i)).Item("Value").saveToFile (localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName"))
objMail.AddAttachment localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName")
End If
Next
End If
objMail.Subject = var_Subject
objMail.BodyText = var_Message
objMail.ContentType = "text/html"
objMail.SendMail
If (Attachments) And (USE_FILESYSTEM_OBJECT) And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.GetFile( localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName") )
MyFile.Delete
End If
Next
End If
SendMail = True
ElseIf (C_MAIL_USE = "Jmail") Then
set objMail = Server.CreateObject("JMail.SMTPMail")
objMail.ServerAddress = SMTP_SERVER
objMail.Sender = var_FromAddress
objMail.AddRecipient var_ToAddress
If (HDW_SEND_CC_TO <> "") Then objMail.CC = HDW_SEND_CC_TO
If Attachments And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
UploadRequest.Item(keys(i)).Item("Value").saveToFile (localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName"))
objMail.AddAttachment localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName")
End If
Next
End If
objMail.Subject = var_Subject
objMail.HTMLBody = var_Message
objMail.Execute
If (Attachments) And (USE_FILESYSTEM_OBJECT) And (var_FlagAttachments) Then
For i = 0 To UploadRequest.Count -1
If (UploadRequest.Item(keys(i)).Exists("FileName")) Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.GetFile( localpath&"_uploadedfile-"&UploadRequest.Item(keys(i)).Item("FileName") )
MyFile.Delete
End If
Next
End If
SendMail = True
End If
End Function
%>
<%
Sub BuildUploadRequest(RequestBin)
'Get the boundary
Dim PosBeg, PosEnd, boundary, boundaryPos, Pos, Name, PosFile, PosBound, FileName, i, Value, gd, tmp
Dim ContentType
PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,RequestBin,boundary)
'Get all data inside the boundaries
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an object name
Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename="))
PosBound = InstrB(PosEnd,RequestBin,boundary)
'Test if object is of file type
If PosFile<>0 AND (PosFile<PosBound) Then
'Get Filename, content-type and content of file
PosBeg = PosFile + 10
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
'Add filename to dictionary object
UploadControl.Add "FileName", CleanFileName(FileName)
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
If Pos = 0 Then
PosEnd = PosEnd+1
' Esto es por el problema de las machintosh con los
' PDF que se esta tragando el context type
Else
PosBeg = Pos+14
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
'Add content-type to dictionary object
ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "ContentType",ContentType
End If
'Get content of object
PosBeg = PosEnd+4
tmp = PosBeg-1
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
Set gd = CreateObject("ADODB.Stream")
gd.Type = 1 ' adTypeBinary
gd.Open
gd.Write RequestBin
gd.Flush
gd.Position=tmp
Set globalbuffer = CreateObject("ADODB.Stream")
globalbuffer.Type = 1 ' adTypeBinary
globalbuffer.Open
On Error Resume Next
globalbuffer.Write gd.Read(PosEnd-PosBeg)
globalbuffer.Flush
globalbuffer.Position=0
UploadControl.Add "Value" , globalbuffer
Else
'Get content of object
Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "Value" , Value
End If
'Add content to dictionary object
'Add dictionary object to main dictionary
If Not UploadRequest.Exists(name) Then
UploadRequest.Add name, UploadControl
Else
' este nuevo cambio es por los select tipo multiple,
' que la version original no se los tragaba
UploadRequest.Item(name).Item("Value") = UploadRequest.Item(name).Item("Value") + ";"+Value
End If
'Loop to next object
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
End Sub
'String to byte string conversion
Function getByteString(StringStr)
Dim i, char
For i = 1 to Len(StringStr)
char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))
Next
End Function
'Byte string to string conversion
Function getString(StringBin)
Dim intCount
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function
Function CleanFileName (fname)
CleanFileName = Right(fname, Len(fname) - InStrRev(fname,"\"))
End Function
%>
Mixing your own code with dreamweaver extensions can be done, but I find it does "break" the extension. The code should work without any issues, you just won't be able to use the "code builder" from inside dreamweaver. I hope that makes sense!
Big_Daddy is correct with his code, but implementing it may be tricky, but doable for sure.
How are you gathering these extra emails? From your database? Form?
Big_Daddy is correct with his code, but implementing it may be tricky, but doable for sure.
How are you gathering these extra emails? From your database? Form?
ASKER
I am getting the information from a form and then sending relevant information by email to different people.
I am finding that as I learn, the programs that are supposed to help (even Dreamweaver) cause more problems.
I am finding that as I learn, the programs that are supposed to help (even Dreamweaver) cause more problems.
Extensions are usually not the option, they are cookie cutter type fixes that rarely ever work how you want them to.
So, if you want to use the code that has already been built in your page, then use Big_Daddy's code to do it. Here is how:
You stated: "I have no problem sending the email, but I want it to go to defferent people depending on the response."
So, depending on the response, you will send the email to different people.
response = Request.Form("response") 'This is how you are pulling your answer
'Use Case as your "filter", if the answer is "a" then do this, if the answer is "b" then do this instead, etc.
select case response
case "response A": '-- if response = "response A"
emailTo = "person1@email.com; person2@email.com"
case "response B": '-- else if response = "response B"
emailTo = "person2@email.com; person3@email.com"
case "response C": '-- if response = "response C"
emailTo = "person3@email.com; person4@email.com"
default: '-- otherwise default to this
emailTo = "default@email.com"
end select
From what I can tell from your code, change the following (line 539 from your EE post):
From this: objMail.To = var_ToAddress
To this: objMail.To = emailTo
Hope this helps!
So, if you want to use the code that has already been built in your page, then use Big_Daddy's code to do it. Here is how:
You stated: "I have no problem sending the email, but I want it to go to defferent people depending on the response."
So, depending on the response, you will send the email to different people.
response = Request.Form("response") 'This is how you are pulling your answer
'Use Case as your "filter", if the answer is "a" then do this, if the answer is "b" then do this instead, etc.
select case response
case "response A": '-- if response = "response A"
emailTo = "person1@email.com; person2@email.com"
case "response B": '-- else if response = "response B"
emailTo = "person2@email.com; person3@email.com"
case "response C": '-- if response = "response C"
emailTo = "person3@email.com; person4@email.com"
default: '-- otherwise default to this
emailTo = "default@email.com"
end select
From what I can tell from your code, change the following (line 539 from your EE post):
From this: objMail.To = var_ToAddress
To this: objMail.To = emailTo
Hope this helps!
ASKER
Thanks to both of you for your help.
Below is my code for the form. Can you suggest an easier way to do this than to use the extension (code in previous comment)?
If not, can you suggest where to integrate Big_Daddy's code into code from the extension. I see several places where it looks like it could go (specifically line 400), but I'm not certain what the integrating will do.
I believe I'm better off (for a number of reasons) starting from scratch--or a code snippet.
Any advice would be appreciated. I increased the point value to 500 as my question has become more involved.
Thanks!
Shari
Below is my code for the form. Can you suggest an easier way to do this than to use the extension (code in previous comment)?
If not, can you suggest where to integrate Big_Daddy's code into code from the extension. I see several places where it looks like it could go (specifically line 400), but I'm not certain what the integrating will do.
I believe I'm better off (for a number of reasons) starting from scratch--or a code snippet.
Any advice would be appreciated. I increased the point value to 500 as my question has become more involved.
Thanks!
Shari
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Room Reservation Form: Room Only</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #f7f5e9;
}
.container {
width: 980px; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
background-color: #F7f5e9;
}
.sidebar_text {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #6c6c6c;
}
.clearfloat {
clear: both;
}
.sidebar_headings {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #2c61a9;
}
.roomtable {
border: thin outset #036;
}
-->
</style>
<link href="../css/header.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="../css/navbar_sothink_980.css" rel="stylesheet" type="text/css" />
<link href="../css/small_header.css" rel="stylesheet" type="text/css" />
<link href="../css/lrdc_footer980.css" rel="stylesheet" type="text/css" />
<script src="../jquery-ui-1.7.2/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script><script src="../SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<link href="../jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet" type="text/css" />
<link href="../jquery-ui-1.7.2/css/base/ui.datepicker.css" rel="stylesheet" type="text/css" />
<link href="../jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet" type="text/css" />
<link href=
<style type="text/css">
<script>
$(document).ready(function() {
$("#datepicker").datepicker();
});
</script>
</style>
<style type="text/css">
#subpage_heading {
margin-top: 20px;
margin-right: 80px;
margin-left: 80px;
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
margin-bottom: 0px;
padding-top: 10px;
padding-right: 15px;
padding-bottom: 5px;
padding-left: 15px;
}
#subpage_heading h3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #2c61a9;
letter-spacing: 3px;
}
#subpage_content {
background-color: #fbfaf4;
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
line-height: 18px;
padding: 10px;
}
#breadcrumbs {
font-family: Verdana, Geneva, sans-serif;
font-size: 11px;
font-variant: small-caps;
color: #FFF;
background-color: #3a5175;
margin-right: 80px;
margin-left: 80px;
padding-left: 16px;
margin-top: 20px;
}
#breadcrumbs a {
color: #FFF;
text-decoration: none;
}
#subpage_content p {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
font-size: 12px;
line-height: 18px;
color: #000000;
}
#subpage_content p a strong {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
font-size: 12px;
line-height: 18px;
color: #00c;
}
#subpage_content tr td {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-size: 12px;
line-height: 20px;
color: #000000;
}
#container #subpage_content ol li {
font-size: 12px;
line-height: 18px;
}
#subpage_content .RAheading a:hover {
text-decoration: underline;
}
#subpage_content ul li {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-size: 12px;
line-height: 20px;
color: #000000;
}
#subpage_content p strong {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
font-size: 12px;
line-height: 20px;
color: #000000;
}
#subpage_content h3 , h4, h5{
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #630;
font-size: 14px;
font-weight: bold;
}
#subpage_content .newsheadings {
font-family: Verdana, Geneva, sans-serif;
font-size: 16px;
font-weight: bold;
color: #FFF;
background-color: #2C61A9;
text-align: center;
}
.heading1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bold;
color: #2c61a9;
letter-spacing: 6px;
}
.bold {
font-weight: bold;
}
.subpage_list {
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
line-height: 22px;
}
body,td,th {
color: #FFF;
}
</style>
</head>
<body>
<div id="subpage_content">
<style type="text/css">
<!--
.style4 { font-size: 18px;
font-style: italic;
}
.style6 {font-size: 16px}
.style8 {
font-size: 18px;
color: #CC0000;
}
.style9 {color: #CC0000}
.style11 {
font-size: 18px;
font-style: italic;
color: #CC0000;
}
-->
</style>
<form action="/HDWForm2Mail/Form2Mail.asp" method="post" name="rr_roomonly" id="rr_roomonly" accept-charset="iso-8859-1">
<p>Please specify the conference room you would like to reserve:</p>
<div id="spryradio4">
<table width="518">
<tr>
<td width="96"><label>
<input type="radio" name="Room" value="1st Floor" id="Room_9" tabindex="1" />
1st Floor</label></td>
<td width="105"><input type="radio" name="Room" value="2nd Floor" id="Room_10" tabindex="2" />
2nd Floor</td>
<td width="106"><input type="radio" name="Room" value="514 LRDC" id="Room_11" tabindex="3" />
514 LRDC</td>
<td width="96"><input type="radio" name="Room" value="565 LRDC" id="Room_12" tabindex="4" />
565 LRDC</td>
<td width="91"><input type="radio" name="Room" value="637 LRDC" id="Room_13" tabindex="5" />
637 LRDC</td>
</tr>
<tr>
<td><input type="radio" name="Room" value="731 LRDC" id="Room_14" tabindex="6"/>
731 LRDC</td>
<td><input type="radio" name="Room" value="809 LRDC" id="Room_15" tabindex="7" />
809 LRDC</td>
<td><input type="radio" name="Room" value="814 LRDC" id="Room_16" tabindex="8" />
814 LRDC</td>
<td><input type="radio" name="Room" value="9th Floor" id="Room_17" tabindex="9" />
9th Floor</td>
<td> </td>
</tr>
</table>
<span class="radioRequiredMsg">Please make a selection.</span></div>
<p><br />
<span id="sprytextfield1">
<label for="Event">Event</label>
<input name="Event" type="text" id="Event" tabindex="10" size="100" />
<span class="textfieldRequiredMsg">A value is required.</span></span></p>
<p> The <a href="http://www2.lrdc.pitt.edu/cgi-bin/calcium38.pl?Op=ShowIt&CalendarName=LRDC_and_Related_Events">LRDC Events calendar</a> is a public calendar displaying events of interest to the LRDC Community). Add event to this calendar?<span id="spryradio2">
<input name="AddtoEventsCal" type="checkbox" class="textfieldInvalidFormatMsg" id="AddtoEventsCal" tabindex="11" />
</span> <span id="spryradio1">
<label>
<input type="radio" name="AddEventsCal" value="Yes" id="AddEventsCal_0" tabindex="12" />
Yes</label>
<label>
<input type="radio" name="AddEventsCal" value="No" id="AddEventsCal_1" tabindex="13" />
No</label>
<span class="radioRequiredMsg">Please make a selection.</span></span><br />
<br />
<label for="datepicker">Date of Event</label>
<input type="text" name="datepicker" id="datepicker" tabindex="14" />
<span class="textfieldRequiredMsg">A value is required.</span><span id="sprytextfield2">
<label for="Start">Start time:</label>
<input name="Start" type="text" id="Start" size="15"tabindex="16" />
<span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield3">
<label for="End">End time:</label>
<input name="End" type="text" id="End" size="15" tabindex="17" />
<span class="textfieldRequiredMsg">A value is required.</span></span></p>
<p><span id="sprytextfield4">
<label for="Requestor">Requested by:</label>
<input name="Requestor" type="text" id="Requestor" size="40" tabindex="18"/>
<span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield6">
<label for="Email"> Email: </label>
<input name="Email" type="text" id="Email" size="50" tabindex="20" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
<p>In order to ensure that we have the appropriate equipment and support staff available and that any needed training occurs prior to your event, it is important that you specify your equipment needs: </p>
<table width="627">
<tr>
<td width="619" height="36"><div id="spryradio5">
<table width="543">
<tr>
<td width="142"><label>
<input type="radio" name="RoomUse" value="Room_Only" id="RoomUse_4" tabindex="21" />
None</label></td>
<td width="148"><input type="radio" name="RoomUse" value="Audiovisual" id="RoomUse_5" tabindex="22" />
Audiovisual</td>
<td width="159"><input type="radio" name="RoomUse" value="Teleconference" id="RoomUse_6" tabindex="23" />
Teleconference</td>
<td width="150"><input type="radio" name="RoomUse" value="Videoconference" id="RoomUse_7" tabindex="24" />
Videoconference</td>
</tr>
</table>
<span class="radioRequiredMsg">Please make a selection.</span></div></td>
</tr>
</table>
<p>
<label for="Comments">Comments: </label>
<textarea name="Comments" id="Comments" cols="45" tabindex="25" rows="5"> </textarea>
</p>
<p>Please verify the information above before submitting so that we may contact you with any questions or inform you of any conflicts. Note that any damage or missing equipment will be the responsibility of the individual/project who reserves the room. </p>
<p>Please direct any questions or problems regarding this form or the Calcium Room Reservations calendars to <a href="mailto:skubitz@pitt.edu">Shari Kubitz</a> (412-624-2881; skubitz@pitt.edu). </p>
<p><span id="sprytextfield7">
<label for="subject"></label>
<input name="subject" type="text" id="subject" value="Room Reservation Request" size="40" />
</span><br />
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
<br />
<input type="hidden" name="hdwemail" id="hdwemail" value="lrdcweb@pitt.edu" />
</p>
<input type="hidden" name="hdwok" id="hdwok" value="../forms/rrform_success.asp" />
<input type="hidden" name="hdwemail" id="hdwemail" value="skubitz+pitt.edu" />
<input type="hidden" name="hdwnook" id="hdwnook" value="roomreserve.asp" />
</form>
<script type="text/javascript">
var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1", {validateOn:["blur"]});
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur"]});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["blur"]});
</script>
</div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
<br class="clearfloat" />
<script type="text/javascript">
var spryradio4 = new Spry.Widget.ValidationRadio("spryradio4", {validateOn:["blur"]});
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false});
var spryradio5 = new Spry.Widget.ValidationRadio("spryradio5");
</script>
</body>
</html>
Shari,
I haven't forgotten about you, give me a little bit and I will shoot you some code (if someone else doesn't answer it first). I am at work and I have to focus on my project.
I haven't forgotten about you, give me a little bit and I will shoot you some code (if someone else doesn't answer it first). I am at work and I have to focus on my project.
ASKER
No problem at all. I am also trying to pull something together with some samples I found.
Take your time.
Shari
Take your time.
Shari
same here, i'm swamped at work. if you still havent gotten help by this weekend, i'll have a more in-depth look!
ASKER
Great. Thanks again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the delay in responding. Thanks so much for your help.
I am going to try it and will let you know what happens.
I am going to try it and will let you know what happens.
ASKER
Thanks again for the code you supplied. It was very helpful and I am beginning to get a better understanding of how to code form to email without using programs that get me into more coding problems.
The first snippet is my attempt at coding the page that processes the form (including the body of the message).
The second one is the actual form (which I have inserted into an iframe on another page.
I am also trying to set up the reply to address as the email address provided by the person completing the form. This would make the From address and ReplyTo address different.
While the form works fine, I am getting the following error when I try to submit the form:
Shari
The first snippet is my attempt at coding the page that processes the form (including the body of the message).
The second one is the actual form (which I have inserted into an iframe on another page.
I am also trying to set up the reply to address as the email address provided by the person completing the form. This would make the From address and ReplyTo address different.
While the form works fine, I am getting the following error when I try to submit the form:
Microsoft VBScript compilation error '800a03f2'
Expected identifier
/lrdclive/Forms/rrsend2.as p, line 106
dim Event
Expected identifier
/lrdclive/Forms/rrsend2.as
dim Event
Shari
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Room Reservation Mail Page</title>
</head>
<body>
<%
dim Room, Event, AddEventsCal, datepicker, StartTime, EndTime, Requestor, Email, RoomUse, Subject, Comments
Room = Request.Form("Room")
Event = Request.Form("Event")
AddEventsCal = Request.Form("AddEventsCal")
datepicker = Request.Form("datepicker")
StartTime = Request.Form("Start")
EndTime = Request.Form("End")
Requestor = Request.Form("Requestor")
Email = Request.Form("Email")
RoomUse = Request.Form("RoomUse")
Subject = Request.Form("Subject")
Comments = Request.Form("Comments")
dim replyEmail, response
response = request.form("Email")
'------------------------------------------------
' Based on the radio button selected, build the
' "toEmail" Address
'------------------------------------------------
dim toEmail, response
response = request.form("RoomUse")
Select Case response
' if you need mulitple emails, seperate with the semicolon ";"
Case "Room_Only"
toEmail = "krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
Case "Audiovisual"
toEmail = "taliani@pitt.edu; efuss@pitt.edu; jmf10@pitt.edu; wilde@pitt.edu; krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
Case "Teleconference"
toEmail = "taliani@pitt.edu; efuss@pitt.edu; jmf10@pitt.edu; wilde@pitt.edu; krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
Case "Videoconference"
toEmail = "taliani@pitt.edu; efuss@pitt.edu; jmf10@pitt.edu; wilde@pitt.edu;; krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
End Select
'------------------------------------------------
' Now lets send the email using CDO
'------------------------------------------------
Set myMail = CreateObject("CDO.Message")
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.pitt.edu"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
' Use the next 2 only if your server requires autentication
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="yourLogin@yourmail.com" 'this is usually an email address
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"
myMail.Configuration.Fields.Update
' Use the config object created above
myMail.From= "lrdcweb@pitt.edu" 'this is the address the email is coming from, usually needs to be setup as an actual email or alias on your server
myMail.ReplyTo= replyEmail 'the reply to address
myMail.To = toEmail 'where the email is going to be sent
myMail.Subject= "Room Reservation Request"
myMail.TextBody=
Response.Write("Room: " & Room & "<br />")
Response.Write("datepicker: " & datepicker & "<br />")
Response.Write("Start: " & Start & "<br />")
Response.Write("End: " & End & "<br />")
Response.Write("Event: " & Event & "<br />")
Response.Write("Add to Events Calendar? " & AddEventsCal & "<br />")
Response.Write("Requestor: " & Requestor & "<br />")
Response.Write("Email: " & Email & "<br />")
Response.Write("Room Use: " & RoomUse & "<br />")
Response.Write("Comments: " & Comments & "<br />")
myMail.Send
%>
</body>
</html>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Room Reservation Form: Room Only</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #f7f5e9;
}
.container {
width: 980px; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
background-color: #F7f5e9;
}
.sidebar_text {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #6c6c6c;
}
.clearfloat {
clear: both;
}
.sidebar_headings {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #2c61a9;
}
.roomtable {
border: thin outset #036;
}
-->
</style>
<link href="../css/header.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="../css/navbar_sothink_980.css" rel="stylesheet" type="text/css" />
<link href="../css/small_header.css" rel="stylesheet" type="text/css" />
<link href="../css/lrdc_footer980.css" rel="stylesheet" type="text/css" />
<script src="../jquery-ui-1.7.2/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script><script src="../SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<link href="../jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet" type="text/css" />
<link href="../jquery-ui-1.7.2/css/base/ui.datepicker.css" rel="stylesheet" type="text/css" />
<link href="../jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet" type="text/css" />
<link href=
<style type="text/css">
<script>
$(document).ready(function() {
$("#datepicker").datepicker();
});
</script>
</style>
<style type="text/css">
#subpage_heading {
margin-top: 20px;
margin-right: 80px;
margin-left: 80px;
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
margin-bottom: 0px;
padding-top: 10px;
padding-right: 15px;
padding-bottom: 5px;
padding-left: 15px;
}
#subpage_heading h3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #2c61a9;
letter-spacing: 3px;
}
#subpage_content {
background-color: #fbfaf4;
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
line-height: 18px;
padding: 10px;
}
#breadcrumbs {
font-family: Verdana, Geneva, sans-serif;
font-size: 11px;
font-variant: small-caps;
color: #FFF;
background-color: #3a5175;
margin-right: 80px;
margin-left: 80px;
padding-left: 16px;
margin-top: 20px;
}
#breadcrumbs a {
color: #FFF;
text-decoration: none;
}
#subpage_content p {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
font-size: 12px;
line-height: 18px;
color: #000000;
}
#subpage_content p a strong {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
font-size: 12px;
line-height: 18px;
color: #00c;
}
#subpage_content tr td {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-size: 12px;
line-height: 20px;
color: #000000;
}
#container #subpage_content ol li {
font-size: 12px;
line-height: 18px;
}
#subpage_content .RAheading a:hover {
text-decoration: underline;
}
#subpage_content ul li {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-size: 12px;
line-height: 20px;
color: #000000;
}
#subpage_content p strong {
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
display: block;
font-size: 12px;
line-height: 20px;
color: #000000;
}
#subpage_content h3 , h4, h5{
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #630;
font-size: 14px;
font-weight: bold;
}
#subpage_content .newsheadings {
font-family: Verdana, Geneva, sans-serif;
font-size: 16px;
font-weight: bold;
color: #FFF;
background-color: #2C61A9;
text-align: center;
}
.heading1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bold;
color: #2c61a9;
letter-spacing: 6px;
}
.bold {
font-weight: bold;
}
.subpage_list {
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
line-height: 22px;
}
body,td,th {
color: #FFF;
}
</style>
</head>
<body>
<div id="subpage_content">
<style type="text/css">
<!--
.style4 { font-size: 18px;
font-style: italic;
}
.style6 {font-size: 16px}
.style8 {
font-size: 18px;
color: #CC0000;
}
.style9 {color: #CC0000}
.style11 {
font-size: 18px;
font-style: italic;
color: #CC0000;
}
-->
</style>
<form action="rrsend2.asp" method="post" name="rrform2" id="rrform2" accept-charset="iso-8859-1">
<p>Please specify the conference room you would like to reserve:</p>
<div id="spryradio4">
<table width="518">
<tr>
<td width="96"><label>
<input type="radio" name="Room" value="1st Floor" id="Room_9" tabindex="1" />
1st Floor</label></td>
<td width="105"><input type="radio" name="Room" value="2nd Floor" id="Room_10" tabindex="2" />
2nd Floor</td>
<td width="106"><input type="radio" name="Room" value="514 LRDC" id="Room_11" tabindex="3" />
514 LRDC</td>
<td width="96"><input type="radio" name="Room" value="565 LRDC" id="Room_12" tabindex="4" />
565 LRDC</td>
<td width="91"><input type="radio" name="Room" value="637 LRDC" id="Room_13" tabindex="5" />
637 LRDC</td>
</tr>
<tr>
<td><input type="radio" name="Room" value="731 LRDC" id="Room_14" tabindex="6"/>
731 LRDC</td>
<td><input type="radio" name="Room" value="809 LRDC" id="Room_15" tabindex="7" />
809 LRDC</td>
<td><input type="radio" name="Room" value="814 LRDC" id="Room_16" tabindex="8" />
814 LRDC</td>
<td><input type="radio" name="Room" value="9th Floor" id="Room_17" tabindex="9" />
9th Floor</td>
<td> </td>
</tr>
</table>
<span class="radioRequiredMsg">Please make a selection.</span></div>
<p><br />
<span id="sprytextfield1">
<label for="Event">Event</label>
<input name="Event" type="text" id="Event" tabindex="10" size="100" />
<span class="textfieldRequiredMsg">A value is required.</span></span></p>
<p> The <a href="http://www2.lrdc.pitt.edu/cgi-bin/calcium38.pl?Op=ShowIt&CalendarName=LRDC_and_Related_Events">LRDC Events calendar</a> is a public calendar displaying events of interest to the LRDC Community). Add event to this calendar?<span id="spryradio2">
<input name="AddtoEventsCal" type="checkbox" class="textfieldInvalidFormatMsg" id="AddtoEventsCal" tabindex="11" />
</span> <span id="spryradio1">
<label>
<input type="radio" name="AddEventsCal" value="Yes" id="AddEventsCal_0" tabindex="12" />
Yes</label>
<label>
<input type="radio" name="AddEventsCal" value="No" id="AddEventsCal_1" tabindex="13" />
No</label>
<span class="radioRequiredMsg">Please make a selection.</span></span><br />
<br />
<label for="datepicker">Date of Event</label>
<input type="text" name="datepicker" id="datepicker" tabindex="14" />
<span class="textfieldRequiredMsg">A value is required.</span><span id="sprytextfield2">
<label for="StartTime">Start time:</label>
<input name="StartTime" type="text" id="Start" size="15"tabindex="16" />
<span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield3">
<label for="EndTime">End time:</label>
<input name="EndTime" type="text" id="End" size="15" tabindex="17" />
<span class="textfieldRequiredMsg">A value is required.</span></span></p>
<p><span id="sprytextfield4">
<label for="Requestor">Requested by:</label>
<input name="Requestor" type="text" id="Requestor" size="40" tabindex="18"/>
<span class="textfieldRequiredMsg">A value is required.</span></span> <span id="sprytextfield6">
<label for="Email"> Email: </label>
<input name="Email" type="text" id="Email" size="50" tabindex="20" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
<p>In order to ensure that we have the appropriate equipment and support staff available and that any needed training occurs prior to your event, it is important that you specify your equipment needs: </p>
<table width="627">
<tr>
<td width="619" height="36"><div id="spryradio5">
<table width="543">
<tr>
<td width="142"><label>
<input type="radio" name="RoomUse" value="Room_Only" id="RoomUse_4" tabindex="21" />
None</label></td>
<td width="148"><input type="radio" name="RoomUse" value="Audiovisual" id="RoomUse_5" tabindex="22" />
Audiovisual</td>
<td width="159"><input type="radio" name="RoomUse" value="Teleconference" id="RoomUse_6" tabindex="23" />
Teleconference</td>
<td width="150"><input type="radio" name="RoomUse" value="Videoconference" id="RoomUse_7" tabindex="24" />
Videoconference</td>
</tr>
</table>
<span class="radioRequiredMsg">Please make a selection.</span></div></td>
</tr>
</table>
<p>
<label for="Comments">Comments: </label>
<textarea name="Comments" id="Comments" cols="45" tabindex="25" rows="5"> </textarea>
</p>
<p>Please verify the information above before submitting so that we may contact you with any questions or inform you of any conflicts. Note that any damage or missing equipment will be the responsibility of the individual/project who reserves the room. </p>
<p>Please direct any questions or problems regarding this form or the Calcium Room Reservations calendars to <a href="mailto:skubitz@pitt.edu">Shari Kubitz</a> (412-624-2881; skubitz@pitt.edu). </p>
<p><span id="sprytextfield7">
<label for="subject"></label>
<input name="subject" type="text" id="subject" value="Room Reservation Request" size="40" />
</span><br />
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
<br />
</form>
<script type="text/javascript">
var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1", {validateOn:["blur"]});
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur"]});
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "email", {validateOn:["blur"]});
</script>
</div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
<br class="clearfloat" />
<script type="text/javascript">
var spryradio4 = new Spry.Widget.ValidationRadio("spryradio4", {validateOn:["blur"]});
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false});
var spryradio5 = new Spry.Widget.ValidationRadio("spryradio5");
</script>
</body>
</html>
Shari,
I can't seem to located that line. I assume the error is on the file called rrsend2.asp? That is where your form is pointing to... can you post the code from that file?
Also, I don't believe you can code the "body" of the email using response.write. Since you are already working within the <% %> blocks, you simply would have to wrap the actual text in quote, ie:
"Room: " & Room & "<br />"
(no need for the response.write). We can cross that bridge when we get there though.
As for the "FROM" and "REPLYTO" addresses, they can be different. The only issue you may run into is the "FROM" address most likely will need to be a valid email that is setup in your email server already and most likely it would have to be from your domain.
Post your code and lets get this solved for you.
I can't seem to located that line. I assume the error is on the file called rrsend2.asp? That is where your form is pointing to... can you post the code from that file?
Also, I don't believe you can code the "body" of the email using response.write. Since you are already working within the <% %> blocks, you simply would have to wrap the actual text in quote, ie:
"Room: " & Room & "<br />"
(no need for the response.write). We can cross that bridge when we get there though.
As for the "FROM" and "REPLYTO" addresses, they can be different. The only issue you may run into is the "FROM" address most likely will need to be a valid email that is setup in your email server already and most likely it would have to be from your domain.
Post your code and lets get this solved for you.
For your Text.Body, it since it is text and not HTML, you can't use <br />, do this instead.
myMail.TextBody= "Room: " & Room & vbcrlf &_
"datepicker: " & datepicker & vbcrlf &_
"Start: " & Start & vbcrlf &_
"End: " & End & vbcrlf &_
"Event: " & Event & vbcrlf &_
"Add to Events Calendar? " & AddEventsCal & vbcrlf &_
"Requestor: " & Requestor & vbcrlf &_
"Email: " & Email & vbcrlf &_
"Room Use: " & RoomUse & vbcrlf &_
"Comments: " & Comments & vbcrlf &_
ASKER
The first snippet was rrsend2, but I am posting it again below as the numbers did not coincide. At first, I had all the dim commands together, but I tried separating them and putting one on each line.
As for the address, I am using an email address I set up for our webserver and it is on the same domain.
Thanks again for your help and patience.
RRSEND2.ASP:
As for the address, I am using an email address I set up for our webserver and it is on the same domain.
Thanks again for your help and patience.
RRSEND2.ASP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Learning Research and Development Center | University of Pittsburgh</title>
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #8D8D8D;
}
.container {
width: 980px; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
background-color: #F7f5e9;
}
.sidebar_text {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #6c6c6c;
}
.clearfloat {
clear: both;
}
.sidebar_headings {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #2c61a9;
}
-->
</style>
<link href="../css/subpage.css" rel="stylesheet" type="text/css" />
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<script type="text/javascript" src="../Templates/stmenu.js"></script>
<link href="../css/navbar_sothink_980.css" rel="stylesheet" type="text/css" />
<link href="../css/small_header.css" rel="stylesheet" type="text/css" />
<link href="../css/lrdc_footer980.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.style5 { font-size: 24px;
color: #CC0000;
font-weight: bold;
font-style: italic;
}
</style>
</head>
<body>
<div class="container" id="container">
<div id="small_header"></div>
<!--#include file="../include/navbar.asp"-->
<div id="subpage_heading">
<h3><!-- TemplateBeginEditable name="heading_title" -->Form Submission Successful<!-- TemplateEndEditable --></h3></div>
<div id="subpage_content"><!-- TemplateBeginEditable name="content" -->
<p>Thank you for your updated information.</p>
<p>If you have any questions, please contact:</p>
<p><a href="mailto:lrangel@pitt.edu">Liz Rangel</a> (Content)</p>
<p><a href="mailto:lrdcweb@pitt.edu">Webmasters</a> (Technical)</p>
<p> </p>
<div id="subpage_content2">
<p class="style5"> </p>
</div>
<!-- TemplateEndEditable --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
<br class="clearfloat" />
<!--#include file="../include/footer.asp"-->
<!--end container div--></div>
<!--#include file="../include/copyright.asp"-->
<script type="text/javascript">
tabberAutomatic(tabberOptions);
</script>
<%
dim Room
dim Event
dim AddEventsCal
dim datepicker
dim StartTime
dim EndTime
dim Requestor
dim Email
dim RoomUse
dim Subject
dim Comments
Room = Request.Form("Room")
Event = Request.Form("Event")
AddEventsCal = Request.Form("AddEventsCal")
datepicker = Request.Form("datepicker")
StartTime = Request.Form("Start")
EndTime = Request.Form("End")
Requestor = Request.Form("Requestor")
Email = Request.Form("Email")
RoomUse = Request.Form("RoomUse")
Subject = Request.Form("Subject")
Comments = Request.Form("Comments")
dim replyEmail, response
response = request.form("Email")
'------------------------------------------------
' Based on the radio button selected, build the
' "toEmail" Address
'------------------------------------------------
dim toEmail, response
response = request.form("RoomUse")
Select Case response
' if you need mulitple emails, seperate with the semicolon ";"
Case "Room_Only"
toEmail = "krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
Case "Audiovisual"
toEmail = "taliani@pitt.edu; efuss@pitt.edu; jmf10@pitt.edu; wilde@pitt.edu; krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
Case "Teleconference"
toEmail = "taliani@pitt.edu; efuss@pitt.edu; jmf10@pitt.edu; wilde@pitt.edu; krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
Case "Videoconference"
toEmail = "taliani@pitt.edu; efuss@pitt.edu; jmf10@pitt.edu; wilde@pitt.edu;; krevy@pitt.edu; mgibson@pitt.edu; ivanhoed@pitt.edu; skubitz@pitt.edu"
End Select
'------------------------------------------------
' Now lets send the email using CDO
'------------------------------------------------
Set myMail = CreateObject("CDO.Message")
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.pitt.edu"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
' Use the next 2 only if your server requires autentication
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="yourLogin@yourmail.com" 'this is usually an email address
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"
myMail.Configuration.Fields.Update
' Use the config object created above
myMail.From= "lrdcweb@pitt.edu" 'this is the address the email is coming from, usually needs to be setup as an actual email or alias on your server
myMail.ReplyTo= replyEmail 'the reply to address
myMail.To = toEmail 'where the email is going to be sent
myMail.Subject= "Room Reservation Request"
myMail.TextBody=
Response.Write("Room: " & Room & "<br />")
Response.Write("datepicker: " & datepicker & "<br />")
Response.Write("Start: " & Start & "<br />")
Response.Write("End: " & End & "<br />")
Response.Write("Event: " & Event & "<br />")
Response.Write("Add to Events Calendar? " & AddEventsCal & "<br />")
Response.Write("Requestor: " & Requestor & "<br />")
Response.Write("Email: " & Email & "<br />")
Response.Write("Room Use: " & RoomUse & "<br />")
Response.Write("Comments: " & Comments & "<br />")
myMail.Send
%>
</body>
</html>
The error is saying there is an issue with the line "dim Event"? Weird... The "expected identifier" error appears to be a script/code issue, meaning it lies with something you typed...
I don't think "Event" is a reserved word in ASP, but I may be wrong...
Can you try renaming your variable? Maybe "eventType"?
Also in the TextBody code I sent you, you will need to leave off the last "&_" as it is not needed on the last line.
I don't think "Event" is a reserved word in ASP, but I may be wrong...
Can you try renaming your variable? Maybe "eventType"?
Also in the TextBody code I sent you, you will need to leave off the last "&_" as it is not needed on the last line.
ASKER
Getting closer...
I found a couple places where the variable I changed earlier needed to be updated and made the changes you suggested.
Now, I get the following error:
Microsoft VBScript compilation error '800a0411'
Name redefined
/lrdclive/Forms/rrsend2.as p, line 135
dim toEmail, response
-------------^
I found a couple places where the variable I changed earlier needed to be updated and made the changes you suggested.
Now, I get the following error:
Microsoft VBScript compilation error '800a0411'
Name redefined
/lrdclive/Forms/rrsend2.as
dim toEmail, response
-------------^
ASKER
I removed the ", response" (as I recognized that error from an earlier problem) and now I am going to retest.
That means toEmail has been defined twice (you type "dim toEmail" more than once in your code).
I scanned the code you posted and I can only see it defined once, so it may be defined in an include file.
You can either rename the variable and change the variable name in your code or you can simply remove that entire line of code (135) as ASP technically doesn't require you to declare your variables.
I scanned the code you posted and I can only see it defined once, so it may be defined in an include file.
You can either rename the variable and change the variable name in your code or you can simply remove that entire line of code (135) as ASP technically doesn't require you to declare your variables.
ASKER
I thought it had been the ",Response"
By removing that, did I create another problem? I wasn't sure if Response was what was redefined.
Shari
By removing that, did I create another problem? I wasn't sure if Response was what was redefined.
Shari
Remove that entire line and that should stop the error.
Response is a "reserved" word (for lack of a better term), you use it in "response.write" (for example). So you may have issues farther down in your code, or you may not, lol.
If you do and the server points to the line where Reserve is used, then maybe change the variable to "userResponse" or something else.
Response is a "reserved" word (for lack of a better term), you use it in "response.write" (for example). So you may have issues farther down in your code, or you may not, lol.
If you do and the server points to the line where Reserve is used, then maybe change the variable to "userResponse" or something else.
If the current error is "Name Redefinded", then you definitely have "dimmed" the same variable more than once.
ASKER
It worked!
The only thing that did not work was the reply to address remained lrdcweb@pitt.edu instead of the Email address included on the form. Can you see what may have caused that?
Thank you so much!!
The only thing that did not work was the reply to address remained lrdcweb@pitt.edu instead of the Email address included on the form. Can you see what may have caused that?
Thank you so much!!
I think it is replyEmail is empty, we assigned email to the wrong variable...
dim replyEmail, response
response = request.form("Email")
-Should be-
dim replyEmail, response
replyEmail = request.form("Email")
(lines 128 and 129 from the post of your code above)
dim replyEmail, response
response = request.form("Email")
-Should be-
dim replyEmail, response
replyEmail = request.form("Email")
(lines 128 and 129 from the post of your code above)
When you don't include a valid reply email, the email server might default to the "from" address as the reply to, but I think that happens at the email server. Providing a valid replyEmail should fix this.
ASKER
Perfect!!! Thanks so much.
In your free time, you may want to check out my other question:
https://www.experts-exchange.com/questions/26938425/ASP-SQL-directory-needs-multiple-detail-pages.html
Thanks again for your patience and even more so for clearly explaining everything so that I understand it.
Shari
In your free time, you may want to check out my other question:
https://www.experts-exchange.com/questions/26938425/ASP-SQL-directory-needs-multiple-detail-pages.html
Thanks again for your patience and even more so for clearly explaining everything so that I understand it.
Shari
ASKER
Wonderful support!
response = Request.Form("response")
select case response
case "response A": '-- if response = "response A"
emailTo = "person1@email.com"
case "response B": '-- else if response = "response B"
emailTo = "person2@email.com"
case "response C": '-- if response = "response C"
emailTo = "person3@email.com"
default: '-- otherwise default to this
emailTo = "default@email.com"
end select
then just add emailTo to your email object's TO property