%@ Language=VBScript %>
<%
dim firstname, lastname, name, email, phone, hometown, other, message, formmessage
if len(Request.Form("submit")) > 0 then
firstname = request.form("firstname")
lastname = request.form("lastname")
name = firstname & " " & lastname
email = request.form("email")
phone = request.form("phone")
hometown = request.form("hometown")
other = request.form("other")
formmessage = request.form("formmessage")
' Checks to see if the user inputted a value
' If so, remove leading and trailing blanks and upcase it
u_email= ucase(trim(request.form("email")))
' Grab the length of the email address inputted
email_len=len(u_email)
' if the user has inputted a value start checking it
if trim(u_email) <> "" then
' Loop that will check each character of the inputted value
' for the @ and the dot
for counter = 1 to email_len
'If there is an @ set u_at to the position it was found in
if mid(u_email,counter,1)="@" then
' count the number of @'s
at_counter=at_counter+1
' if there is more than one add it to the message
if at_counter > 1 then message = message &"There appear to be multiple @'s in the email address " end if
' if this is the 1st @ note the location in the string
if u_at = "" then
u_at=counter
end if ' end check for first @
end if ' end check for the @
'If there is an dot (.) set u_dot to the position it was found in
if mid(u_email,counter,1)="." then
if u_dot = "" then
u_dot=counter
end if 'end check for the first dot
end if 'end check for the dot
next
' 1/2/06 do not check this b/c some people have a dot in the front of the add: sarah
' Check to see if the dot comes after the @
' and that the first dot is not the last character
'if (u_dot < u_at) or (len(u_email) <= u_dot+1) or ((u_dot-u_at) < 2) then
'message = message & "Email format appears to be wrong "
'end if 'end check for dot after the @
'3/6/06 sarah add check to make sure there is a period after the @ and the period is not the last character
if len(u_at)>0 then
if InStr(u_at,u_email,".") = 0 then
message = message & "Email address is missing period after the @ symbol "
end if
end if
if InStr(u_email,".") = email_len then
message = message & "Valid email cannot end in a period "
end if
'3/13/06 sarah check for double periods
if Instr(u_email,"..") > 0 then
message = message & "Valid email cannot have two periods in a row "
end if
'9/4/06 sarah check name
if len(firstname) = 0 then message = message & "Please enter your first name. "
if len(lastname) = 0 then message = message & "Please enter your last name. "
if (len(firstname)> 0) and (firstname = lastname) then message = message & "First name and last name are identical. "
' Scan the user input to see that all inputted values are either a letter A-Z,
' a number 0-9 or if the character is a . or and @.
' 1/2/06 added underscore to acceptable characters: sarah
for counter=1 to len(u_email)
if (mid(u_email,counter,1) <> "/") and ((mid(u_email,counter,1) > chr(45)) and (mid(u_email,counter,1) < chr(58))) or ((mid(u_email,counter,1) > chr(63)) and (mid(u_email,counter,1) < chr(91))) or (mid(u_email,counter,1) = chr(95)) or (mid(u_email,counter,1) = "-") then
else
' If it's an invalid charcter add it to the display message
message = message & "Invalid character "& mid(u_email,counter,1)& " found in email address "
end if 'end check for invalid characters
next 'end loop for invalid characters
end if 'end check for user input
' If the email address os not OK than display the message(s)
' and show the text box for user input with the last value pre-filled
if u_email = "" then
message = "Please enter a valid email address."
end if
if message = "" then
dim MXLookUp
MXLookUp = TRUE
if ucase(lastname)="NAME" or ucase(lastname)="BLACCKY" then
MXLookUp = FALSE
end if
if MXLookUp = TRUE then
dim sch
dim cdoConfig
dim cdoMessage
dim body
body = body & "Name: " & Request.Form("name") & vbcrlf
body = body & "Email: " & Request.Form("email") & vbcrlf
body = body & "Phone: " & Request.Form("phone") & vbcrlf & vbcrlf
body = body & "Hometown: " & Request.Form("hometown") & vbcrlf & vbcrlf
body = body & "Referred by: " & Request.Form("refer")
if len(Request.Form("other")) > 0 then
body = body & ": " & Request.Form("other")
end if
body = body & vbcrlf & vbcrlf
body = body & Request.Form("newsletter") & vbcrlf & vbcrlf
body = body & "Message: " & Request.Form("formmessage") & vbcrlf & vbcrlf
'if they want the newsletter, save their info to a file
'8/1 send their info to maillist king directly instead of text file
'if len(request.form("newsletter")) > 0 then
'dim body1
'body1 = body1 & "Action: Subscribe" & vbcrlf
'body1 = body1 & "Email: " & Request.Form("email") & vbcrlf
'body1 = body1 & "Group: Subscribers" & vbcrlf
'body1 = body1 & "First Name: " & Request.Form("firstname") & vbcrlf
'body1 = body1 & "Last Name: " & Request.Form("lastname") & vbcrlf
'sch = "http://schemas.microsoft.com/cdo/configuration/"
'Set cdoConfig = Server.CreateObject("CDO.Configuration")
'cdoConfig.Fields.Item(sch & "sendusing") = 2
'cdoConfig.Fields.Item(sch & "smtpserver") = "mail.fountainshosting.com"
'cdoConfig.fields.update
'Set cdoMessage = Server.CreateObject("CDO.Message")
'Set cdoMessage.Configuration = cdoConfig
'cdoMessage.From = Request.Form("email")
'cdoMessage.To = "sovenall@nc.rr.com"
'cdoMessage.To = "newsletter@peoplespharmacy.com"
'cdoMessage.Subject = "Web Form Submission"
'cdoMessage.TextBody = body1
'cdoMessage.Send
'Set cdoMessage = Nothing
'Set cdoConfig = Nothing
'FilePath = "/home/buildpp/public_html/newsletter.txt"
'TextToAdd = Request.Form("email") & "," & Request.Form("name") & ", " & dateis & " " & timeis
'Set fso=Server.CreateObject("Scripting.FileSystemObject")
'Set ts = fso.OpenTextFile(FilePath,8,True)
'ts.WriteLine(TextToAdd)
'ts.close
'set ts = NOTHING
'set fso = NOTHING
'end if
' 5/4/06 Altered "To" to send to macilbox contactform@peoplespharmacy.com and
' added "Bcc" to Joe at gmail.com
ReplyTo = Request.Form("email")
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserver") = "mail.fountainshosting.com"
cdoConfig.fields.update
Set cdoMessage = Server.CreateObject("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "contactform@peoplespharmacy.com"
'cdoMessage.From = Request.Form("email")
if ubound(split(formmessage,"http://")) < 3 then 'if there are more that 2 URLs
'cdoMessage.To = "sarah@denovo.net"
cdoMessage.ReplyTo = ReplyTo
cdoMessage.To = "contactform@peoplespharmacy.com"
cdoMessage.Subject = "Ask People's Pharmacy"
cdoMessage.TextBody = body
cdoMessage.Send
else
'cdoMessage.To = "nobody@netenterprises.com"
end if
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.redirect "contactthanks.asp"
else Response.redirect "contactthanks.asp"
end if
end if
end if %>
Contact People's Pharmacy
<%
if message <> "" then
response.write "
" & message & "
"
end if
%>
Contact People's Pharmacy®
A message from Joe and Terry Graedon of The People's Pharmacy®:
Have we written about your question in our columns, guides, and other resources of People's Pharmacy® ? Find out now by entering a keyword in the search box above and clicking "search."
If you still haven't found what you're looking for, fill out the form below or e-mail us at questions@peoplespharmacy.com, and we'll see if we can answer your question in an upcoming column. We answer e-mail questions each week in our columns, newsletters and on our weekly public radio show. If your question is answered in either of those places, you'll find a written version of the answer on the site.
If you want to stay informed about all the topics and questions covered in our columns and on our weekly radio show, be sure to sign up for The People's Pharmacy® Newsletter, our e-mail newsletter that brings you summaries and links to in-depth information on the topics and questions we cover each week.
If your question is not selected for use in our columns or on-air, we're sorry. We hope you'll find plenty of useful information on the site. Thanks for visiting The People's Pharmacy® online.