Jump to content

Autoresponder


faraznj
 Share

Recommended Posts

Hi guysI have a ASP code which can send me email, but I want also make a autoresponder to client. Can any body help me with this?This is the code:<%For Field = 1 to Request.Form.Count - 3FieldName = Replace(Request.Form.Key(Field),"_"," ")FieldValue = Request.Form.Item(Field)Body = Body & FieldName & ": " & FieldValue & VbCrLfNext'Dimension variablesDim objCDOSYSCon'Create the e-mail server objectSet objCDOSYSMail = Server.CreateObject("CDO.Message")Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")'Set and update fields propertiesWith objCDOSYSCon'Outgoing SMTP server.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.domain.com".Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25'CDO Port.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2'Timeout.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60.Fields.UpdateEnd With'Update the CDOSYS ConfigurationSet objCDOSYSMail.Configuration = objCDOSYSCon'Set and update email propertiesWith objCDOSYSMail'0=Low, 1=Normal, 2=High.Fields("urn:schemas:httpmail:importance").Value = 1'Who the e-mail is from.From = "ex@domain.com"'Who the e-mail is sent to.To = "example@domain.com"'Who the e-mail is CC'd to.Cc = Request.Form("email_address")'The subject of the e-mail.Subject = Request.Form("email_subject")'Set the e-mail body format (HTMLBody=HTML TextBody=Plain).TextBody = Body.Fields.Update'Send the e-mail.SendEnd With'Close the server mail objectSet objCDOSYSMail = NothingSet objCDOSYSCon = Nothing'Rederect after sending emailResponse.Redirect Request.Form("redirect_to")%>

Link to comment
Share on other sites

One thing that I find useful for email code like this that you will reuse is to create a function place it into a file of it's own as an .incEach file that needs the code add it at the top and then just pass variables into the function for each of the fields.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...