Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 16, 2012, 05:48:17 PM

Pages: [1]   Go Down
  Print  
Author Topic: solution to using form to send email from ASP page using CDOSYS  (Read 2208 times)
ajmasters
Newbie
*
Offline Offline

Posts: 3


« on: October 27, 2007, 08:01:57 PM »

Hi,
this is to help others on Windoze hosting plans who may be having problems setting their asp form to send them an email, feedback etc.

I was able to get the CDOSYS script working on my Windoze hosting plan after making the following modifications.  That script can be found under asp in the knowledgebase website of Lunarpages:  https://support.lunarpages.com/knowledge_bases/article/273
Note, my domain name is: ajmasters.com

1 - Make sure the email you use to send FROM does exist with your domain.  i.e. you need to create an email with your domain name.
ex: I created this email:   fromWeb@ajmasters.com
2-  Make sure the email you send TO does exist with your domain.  It did not work when trying to send to an email outside like something@yahoo.com  but it did ok when using my own. i.e. you need to create an email with your domain name.  (you can then set that email to redirect outside if you want)  ex: I created this email:   Tomyself@ajmasters.com
3-  Change the port from 25 to 2 on this line:   Const cdoSendUsingPort = 2

Here is the script below,  make the appropriate changes using your own domain name.


          Dim iMsg
          Dim iConf
          Dim Flds
          Dim strHTML
          Dim strSmartHost
          Const cdoSendUsingPort = 2
          StrSmartHost = "localhost"
          set iMsg = CreateObject("CDO.Message")
          set iConf = CreateObject("CDO.Configuration")
          Set Flds = iConf.Fields
          With Flds
          .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
          .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
          .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
          .Update
          End With
          strBody = "This is a test of sending an email via ASP" & vbCrLf & vbCrLf
          strBody = strBody & "This is line 2. " & vbCrLf
          strBody = strBody & "you can have as many as you want" & vbCrLf
          strBody = strBody & "THIS IS AN AUTOMATED EMAIL - PLEASE DO NOT REPLY"
          With iMsg
          Set .Configuration = iConf
          .To = "Tomyself@ajmasters.com"
          .From = "fromWeb@ajmasters.com"
          .Subject = "LEADS FROM MY FORM "
          .textbody = strBody
          'redirect code goes here
          .Send
          End With
          ' cleanup of variables
          Set iMsg = Nothing
          Set iConf = Nothing
          Set Flds = Nothing



« Last Edit: October 27, 2007, 08:05:01 PM by ajmasters » Logged
Pages: [1]   Go Up
  Print  
 
Jump to: