|
|
|
|
|
|
<%
'Declaring Variables
Dim smtpserver,youremail,yourpassword,firstname,ContactUs_Email,address,country,s_tate,pincode,phone,mobile,emailid,location,years,role,salary,qualification,jobtype,key,area_experience,sub_experience
Dim ContactUs_Subject,ContactUs_Body,Action,IsError
' Edit these 3 values accordingly.. leave the smtp server alone as it is set for Gmail
smtpserver = "smtp.gmail.com"
youremail = "tatiainfo@gmail.com"
yourpassword = "tatiainfo2009"
' Grabbing variables from the form post
ContactUs_Name = Request.Form("ContactUs_Name")
address = Request.Form("address")
country =Request.Form("country")
s_tate=Request.Form("s_tate")
pincode=Request.Form("pincode")
phone=Request.Form("phone")
mobile=Request.Form("mobile")
emailid=Request.Form("emailid")
location=Request.Form("location")
years=Request.Form("years")
role=Request.Form("role")
salary=Request.Form("salary")
qualification=Request.Form("qualification")
jobtype=Request.Form("jobtype")
key=Request.Form("key")
area_experience=Request.Form("area_experience")
sbu_experience=Request.Form("sbu_experience")
Action = Request("Action")
' Used to check that the email entered is in a valid format
Function IsValidEmail(Email)
Dim ValidFlag,BadFlag,atCount,atLoop,SpecialFlag,UserName,DomainName,atChr,tAry1
ValidFlag = False
If (Email <> "") And (InStr(1, Email, "@") > 0) And (InStr(1, Email, ".") > 0) Then
atCount = 0
SpecialFlag = False
For atLoop = 1 To Len(Email)
atChr = Mid(Email, atLoop, 1)
If atChr = "@" Then atCount = atCount + 1
If (atChr >= Chr(32)) And (atChr <= Chr(44)) Then SpecialFlag = True
If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True
If (atChr >= Chr(58)) And (atChr <= Chr(63)) Then SpecialFlag = True
If (atChr >= Chr(91)) And (atChr <= Chr(94)) Then SpecialFlag = True
Next
If (atCount = 1) And (SpecialFlag = False) Then
BadFlag = False
tAry1 = Split(Email, "@")
UserName = tAry1(0)
DomainName = tAry1(1)
If (UserName = "") Or (DomainName = "") Then BadFlag = True
If Mid(DomainName, 1, 1) = "." then BadFlag = True
If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True
ValidFlag = True
End If
End If
If BadFlag = True Then ValidFlag = False
IsValidEmail = ValidFlag
End Function
%>
<%
' If there were no input errors and the action of the form is "SendEMail" we send the email off
If Action = "SendEmail" Then
Dim strBody
' Here we create a nice looking html body for the email
strBody = strBody & "Contact Us Form submitted at " & Now() & vbCrLf & "
"
strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") & vbCrLf & " "
strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & " "
trBody = strBody & "country" & " : " & " " & Replace(country,vbCr," ") & " "
strBody = strBody & "State" & " : " & " " & Replace(s_tate,vbCr," ") & " "
strBody = strBody & "Pincode" & " : " & " " & Replace(pincode,vbCr," ") & " "
strBody = strBody & "Residence Phone" & " : " & " " & Replace(phone,vbCr," ") & " "
strBody = strBody & "Mobile Number" & " : " & " " & Replace(mobile,vbCr," ") & " "
strBody = strBody & "Email Id" & " : " & " " & Replace(emailid,vbCr," ") & " "
strBody = strBody & "Current Location" & " : " & " " & Replace(location,vbCr," ") & " "
strBody = strBody & "Total Experience(in years)" & " : " & " " & Replace(years,vbCr," ") & " "
strBody = strBody & "Current Salary" & " : " & " " & Replace(salary,vbCr," ") & " "
strBody = strBody & "Qualification" & " : " & " " & Replace(qualification,vbCr," ") & " "
strBody = strBody & "Job Type" & " : " & " " & Replace(jobtype,vbCr," ") & " "
strBody = strBody & "Key Skills" & " : " & " " & Replace(key,vbCr," ") & " "
strBody = strBody & "Area of Experience" & " : " & " " & Replace(area_experience,vbCr," ") & " "
strBody = strBody & "Sub Experience" & " : " & " " & Replace(sub_experience,vbCr," ") & " "
strBody = strBody & ""
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 'Use SSL for the connection
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = youremail
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourpassword
ObjSendMail.Configuration.Fields.Update
'End remote SMTP server configuration section==
ObjSendMail.To = youremail
ObjSendMail.Subject = Request.Form("ContactUs_Name")
ObjSendMail.From = "jalexcse@gmail.com"
' we are sending a html email.. simply switch the comments around to send a text email instead
ObjSendMail.HTMLBody =strBody
'ObjSendMail.TextBody = strBody
ObjSendMail.Send
Set ObjSendMail = Nothing
' change the success messages below to say or do whatever you like
' you could do a response.redirect or offer a hyperlink somewhere.. etc etc
%>
Your message seen below has been sent. Thank You !!. We will contact you shotly
<% =Replace(address,vbCr," ") %>
<% Else %>
<% End If %> |
|
|
|
|
|
|
|