<%@ Language = VBScript %> <% Option Explicit %> <% response.buffer = true response.expiresAbsolute = #1/1/2000# response.CacheControl = "Private" dim relative_path_to_database relative_path_to_database = "../2020applications.mdb" %> <% set rs = cn.Execute("SELECT people.title,people.firstname,people.lastname,people.email,properties.display_title,properties.address,properties.city FROM properties INNER JOIN (people INNER JOIN people_property_link ON people.peopleID = people_property_link.peopleID) ON properties.propertyID = people_property_link.propertyID WHERE properties.propertyID = "& request.querystring("ID") &";") rs.movefirst dim action, text_string, OK, subject, this_URL, strBody, Mail, rs2, company_email action = "default" text_string = "" OK = 1 IF len(request.form) > 0 THEN IF CheckEmail(request.form("sender_email")) = "False" THEN OK = 0 text_string = "It seems that your email address is invalid. Perhaps you typed it incorrectly." END IF IF CheckEmail(rs("email")) = "False" THEN OK = 0 text_string = "It seems that our "& LCase(Agent) &"'s email address is temporarily unavailable, or perhaps they typed it incorrectly. It is not a valid email address. Please contact another "& LCase(Agent) &", the webmaster, or the administrator of this web site...you might also mention in your message that "& rs("firstname") &" needs to update their email address." END IF IF OK = 1 THEN set rs2 = cn.Execute("SELECT * FROM people WHERE peopleID = 1;") rs2.movefirst subject = rs2("companyname") this_URL = rs2("URL") company_email = rs2("email") rs2.close set rs2 = nothing subject = subject & ": "& rs("display_title") &" - "& rs("address") IF rs("address") <> "" THEN subject = subject & ", " END IF subject = subject & rs("city") strBody = "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "" strBody = strBody & "

Hello "& rs("firstname") strBody = strBody & "

" strBody = strBody & "

This is a message from a visitor of your web site, "& this_URL &", named " IF request.form("sender_name") <> "" AND request.form("sender_name") <> "Your Name" THEN strBody = strBody & request.form("sender_name") ELSE strBody = strBody & request.form("sender_email") END IF strBody = strBody & ".

" IF request.form("sender_name") <> "" AND request.form("sender_name") <> "Your Name" THEN strBody = strBody & request.form("sender_name") ELSE strBody = strBody & request.form("sender_email") END IF strBody = strBody & " is interested in learning more about your listing: "& rs("display_title") &".

" IF Len(request.form("memo")) > 0 THEN IF request.form("sender_name") <> "" AND request.form("sender_name") <> "Your Name" THEN strBody = strBody & request.form("sender_name") ELSE strBody = strBody & request.form("sender_email") END IF strBody = strBody & " sends this message:

"& request.form("memo") &"
" END IF IF request.servervariables("HTTP_REFERER") = "" THEN strBody = strBody & "

Click here to view the property online. Or you can Reply directly by choosing "Reply" in the toolbar above.

" ELSE strBody = strBody & "

Click here to view the property online. Or you can Reply directly by choosing "Reply" in the toolbar above.

" END IF strBody = strBody & "" strBody = strBody & "" Mail = GetMailObjectVariables email_properties = Split(Mail,",") Mail = "" Dim iConf, Flds IF email_properties(1) = "CDONTS" THEN set Mail = Server.CreateObject("CDONTS.NewMail") Mail.From = request.form("sender_email") IF allowAgentEmail THEN Mail.To = rs("email") ELSE Mail.To = company_email END IF Mail.Subject = subject Mail.BodyFormat = 0 Mail.MailFormat = 0 Mail.Body = strBody Mail.Send set Mail = nothing ELSEIF email_properties(1) = "CDOSYS" THEN set Mail = Server.CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") set Flds = iConf.Fields WITH Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = email_properties(10) .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 .Update END WITH WITH Mail set .Configuration = iConf IF allowAgentEmail THEN .To = rs("email") ELSE .To = company_email END IF .From = request.form("sender_email") '.Sender = request.form("sender_email") .Subject = subject .HTMLBody = strBody .Send END WITH set Mail = nothing ELSEIF email_properties(1) = "ASPEmail" THEN set Mail = server.CreateObject("Persits.MailSender") Mail.Host = email_properties(10) Mail.IsHTML = True Mail.From = request.form("sender_email") Mail.FromName = request.form("sender_email") IF allowAgentEmail THEN Mail.AddAddress rs("email") ELSE Mail.AddAddress company_email END IF Mail.AddReplyTo request.form("sender_email") Mail.Subject = subject Mail.Body = strBody IF email_properties(13) = "1" THEN Mail.ContentTransferEncoding = "quoted-printable" Mail.SendToQueue ELSE On Error Resume Next Mail.Send IF Err <> 0 THEN OK = 0 text_string = "

There's been an error and your message could not be sent.

" text_string = text_string & "

Please try to send the message again. Our email service gave this error description:" & Err.Description &"

" END IF END IF set Mail = nothing ELSEIF email_properties(1) = "ASPMail" THEN set Mail = Server.CreateObject("SMTPsvg.Mailer") Mail.ContentType = "text/html" Mail.FromName = request.form("sender_email") Mail.FromAddress= request.form("sender_email") Mail.RemoteHost = email_properties(10) IF allowAgentEmail THEN Mail.AddRecipient rs("email"),rs("email") ELSE Mail.AddRecipient company_email,company_email END IF Mail.Subject = subject Mail.BodyText = strBody IF Mail.SendMail THEN ' ELSE OK = 0 text_string = "

There's been an error and your message could not be sent.

" text_string = text_string & "

Please try to send the message again. Our email service gave this error description:" & Mail.Response &"

" END IF set Mail = nothing ELSEIF email_properties(1) = "JMail" THEN set Mail = Server.CreateObject("JMail.SMTPMail") Mail.ServerAddress = email_properties(10) IF email_properties(13) = "1" THEN Mail.MailServerUserName = email_properties(16) Mail.MailServerPassword = email_properties(19) END IF Mail.ContentType = "text/html" Mail.Sender = request.form("sender_email") Mail.Subject = subject IF allowAgentEmail THEN Mail.AddRecipient rs("email") ELSE Mail.AddRecipient company_email END IF Mail.Body = strBody Mail.AddHeader "Originating-IP",request.ServerVariables("REMOTE_ADDR") Mail.Execute set Mail = nothing ELSEIF email_properties(1) = "SASMTPMail" THEN set Mail = Server.CreateObject("SoftArtisans.SMTPMail") Mail.FromName = request.form("sender_email") Mail.FromAddress = request.form("sender_email") Mail.RemoteHost = email_properties(10) IF allowAgentEmail THEN Mail.AddRecipient rs("email") ELSE Mail.AddRecipient company_email END IF Mail.Subject = subject Mail.HTMLText = strBody IF Mail.SendMail THEN ' ELSE OK = 0 text_string = "

There's been an error and your message could not be sent.

" text_string = text_string & "

Please try to send the message again and make sure that you typed your email address correctly...this is most likely the problem.

" END IF set Mail = nothing ELSEIF email_properties(1) = "MailEnable" THEN set Mail = Server.CreateObject("MEMail.Message") Mail.MailFromDisplayName = request.form("sender_email") Mail.MailFrom = request.form("sender_email") Mail.Server = email_properties(10) IF allowAgentEmail THEN Mail.MailTo = rs("email") ELSE Mail.MailTo = company_email END IF Mail.Subject = subject Mail.ContentType = "text/html;" Mail.MessageBody = strBody IF Mail.SendMessage = 0 THEN OK = 0 text_string = "

There's been an error and your message could not be sent.

" text_string = text_string & "

Please try to send the message again and make sure that you typed your email address correctly...this is most likely the problem.

" END IF set Mail = nothing END IF action = "done" END IF END IF %> Inquire About This Property
<% IF action = "default" THEN %>
>

Inquire About This Property

<% IF allowAgentEmail THEN %> <% END IF %>
To:   <%=rs("title")%> <%=rs("firstname")%> <%=rs("lastname")%>
From:   "" THEN response.write(request.form("sender_name")) ELSE response.write("Your Name") END IF %>" name=sender_name size=22 onFocus=check_this_field('sender_name');>
  "" THEN response.write(request.form("sender_email")) ELSE response.write("Your Email") END IF %>" name=sender_email size=22 onFocus=check_this_field('sender_email');>
Property:   <%=rs("display_title")%> - <%=rs("address")%> <% IF rs("address") <> "" THEN response.write(", ") %> <%=rs("city")%>
Message:  
 
<%=text_string%>
<% ELSE IF OK = 1 THEN %>

Finished!

Your message has been sent to our <%=LCase(Agent)%>. We will respond as soon as possible.

<% ELSE %>

Oops...

<%=text_string%> <% END IF %>
Click here to close this window.
<% END IF %> <% rs.close set rs = nothing cn.close set cn = nothing %>