% ' Function Declarations Sub GenerateEmail(strFrom, strTo, strSubject, strMessage) Dim objConfig Dim objMessage Dim strSch Set objConfig = Server.CreateObject("CDO.Configuration") Set objMessage = Server.CreateObject("CDO.Message") Set objMessage.Configuration = objConfig strSch = "http://schemas.microsoft.com/cdo/configuration/" objConfig.Fields.Item(strSch & "sendusing") = 2 objConfig.Fields.Item(strSch & "smtpserver") = "10.1.1.12" objConfig.fields.update objMessage.From = strFrom objMessage.To = strTo objMessage.Subject = strSubject objMessage.TextBody = strMessage objMessage.Send Set objMessage = Nothing Set objConfig = Nothing End Sub ' Test to see if the page is posted. If len(Request.Form("btnSubmit")) > 0 Then ' Declare local variable to hold the "Thank You" page location. Dim lsThankYouPage ' Declare local email varialbes. Dim lsEmailFrom Dim lsEmailTo Dim lsEmailSubject Dim lsEmailBody ' Decalare local variables to hold form data. Dim lsFirstName Dim lsLastName Dim lsAffiliation Dim lsTitle Dim lsAddress Dim lsCity Dim lsState Dim lsZip Dim lsCountry Dim lsPhone Dim lsFax Dim lsEmail ' Set the redirect page. lsThankYouPage = "http://www.pff.org/events/upcomingevents/thanks.html" ' Assign form fields to local variables lsFirstName = Request.Form("msFirstName") lsLastName = Request.Form("msLastName") lsAffiliation = Request.Form("msAffiliation") lsTitle = Request.Form("msTitle") lsAddress = Request.Form("msAddress") lsCity = Request.Form("msCity") lsState = Request.Form("msState") lsZip = Request.Form("msZip") lsCountry = Request.Form("msCountry") lsPhone = Request.Form("msPhone") lsFax = Request.Form("msFax") lsEmail = Request.Form("msEmail") ' Build email header and body information. lsEmailFrom = lsEmail lsEmailTo = "events@pff.org" lsEmailSubject = "042908 CEO Ganley Luncheon Registration" lsEmailBody = "First Name: " & lsFirstName & vbcrlf lsEmailBody = lsEmailBody & "Last Name: " & lsLastName & vbcrlf lsEmailBody = lsEmailBody & "Affiliation: " & lsAffiliation & vbcrlf lsEmailBody = lsEmailBody & "Title: " & lsTitle & vbcrlf lsEmailBody = lsEmailBody & "Address: " & lsAddress & vbcrlf lsEmailBody = lsEmailBody & "City: " & lsCity & vbcrlf lsEmailBody = lsEmailBody & "State: " & lsState & vbcrlf lsEmailBody = lsEmailBody & "Zip: " & lsZip & vbcrlf lsEmailBody = lsEmailBody & "Country: " & lsCountry & vbcrlf lsEmailBody = lsEmailBody & "Phone: " & lsPhone & vbcrlf lsEmailBody = lsEmailBody & "Fax: " & lsFax & vbcrlf lsEmailBody = lsEmailBody & "Email: " & lsEmail & vbcrlf ' Send the email. GenerateEmail lsEmailFrom, lsEmailTo, lsEmailSubject, lsEmailBody ' Redirect to the "Thank You" page. Response.Redirect(lsThankYouPage) Else %>
|