Add this page to your project with name of mail.asp and save following code into it.
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
txtname = Request.Form("txtname")
'txtcompanyname= Request.Form("txtcompanyname")
txtadd = Request.Form("txtadd")
txtzip= Request.Form("txtzip")
txtcity = Request.Form("txtcity")
txtstate = Request.Form("txtstate")
txtcountry = Request.Form("txtcountry")
txtph = Request.Form("txtph")
txtfax = Request.Form("txtfax")
txtemail = Request.Form("txtemail")
txtquery = Request.Form("txtquery")
MailBody="Enquiry Form <br>" _
& "Name: " & txtname & "<br>" _
& "Address: " & txtadd & "<br>" _
& "City: " & txtcity & "<br>" _
& "State: " & txtstate & "<br>" _
& "Zip: " & txtzip & "<br>" _
& "Country: " & txtcountry & "<br>" _
& "Phone: " & txtph & "<br>" _
& "Fax: " & txtfax & "<br>" _
& "Email: " & txtemail & "<br>" _
& "Query: " & txtquery
usernm = "admin@admin.com"
pass = "ja"
Set objmessage = CreateObject("CDO.Message")
objmessage.Subject = "Enquiry Form Submitted: Query"
objmessage.From = "admin@admin.com"
objmessage.To = "info@admin.com"
objmessage.BCC = "info@admin.com"
objmessage.HTMLBody = MailBody
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = usernm
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = pass
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
objmessage.Configuration.Fields.Update
objmessage.Send
Set objmessage = Nothing
response.redirect "enquiry.html"
end if
%>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
txtname = Request.Form("txtname")
'txtcompanyname= Request.Form("txtcompanyname")
txtadd = Request.Form("txtadd")
txtzip= Request.Form("txtzip")
txtcity = Request.Form("txtcity")
txtstate = Request.Form("txtstate")
txtcountry = Request.Form("txtcountry")
txtph = Request.Form("txtph")
txtfax = Request.Form("txtfax")
txtemail = Request.Form("txtemail")
txtquery = Request.Form("txtquery")
MailBody="Enquiry Form <br>" _
& "Name: " & txtname & "<br>" _
& "Address: " & txtadd & "<br>" _
& "City: " & txtcity & "<br>" _
& "State: " & txtstate & "<br>" _
& "Zip: " & txtzip & "<br>" _
& "Country: " & txtcountry & "<br>" _
& "Phone: " & txtph & "<br>" _
& "Fax: " & txtfax & "<br>" _
& "Email: " & txtemail & "<br>" _
& "Query: " & txtquery
usernm = "admin@admin.com"
pass = "ja"
Set objmessage = CreateObject("CDO.Message")
objmessage.Subject = "Enquiry Form Submitted: Query"
objmessage.From = "admin@admin.com"
objmessage.To = "info@admin.com"
objmessage.BCC = "info@admin.com"
objmessage.HTMLBody = MailBody
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = usernm
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = pass
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
objmessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
objmessage.Configuration.Fields.Update
objmessage.Send
Set objmessage = Nothing
response.redirect "enquiry.html"
end if
%>
Comments
Post a Comment