|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CDONTS and me...
I went searching this site and the web and finally came across some documentation pertaining to the use of CDONTS that was more then asking how to use them... The useful ones must be deleted from here or i am using the wrong search keywords... anyway, i found this code as part of the MS documentation and as i do not enjoy MS or rely on their ability to be right, i bring it to you, the professionals for critique... Please let me know if the functionality is good, useable, needs improvement and where, it's mostly documentation so not a lot to read.. Thanks! ~ code:---------------------------------------------------------- '============================================= ' Send the results to e-mail. ' Use CDONTS to create and send a message based on information ' entered into the form. The following lines compose and send ' the e-mail. '============================================= '============================================= ' Set up variables: ' myCDONTSMail = A CDONTS mail object. ' strFrom = A string containing the source e-mail address. ' strTo = A string containing the destination e-mail address. ' strSubject = A string containing the subject of the e-mail. ' strBody = A string containing the body of the e-mail. '============================================= Dim myCDONTSMail Dim strFrom Dim strTo Dim strSubject Dim strBody '%%%%%%%%%%%%%%%%%%%%%%%%%%% ' Assign the source e-mail address. Change this to your e-mail address. '%%%%%%%%%%%%%%%%%%%%%%%%%%%% strFrom="example@microsoft.com" '%%%%%%%%%%%%%%%%%%%%%%%%%%%% ' Assign the destination e-mail address. In this example, get the ' e-mail address from the form field called "EMail". ' You can customize this by removing the EMail form field and ' changing the following line to this: ' strTo="example@microsoft.com" ß Change this to your e-mail ' address. '%%%%%%%%%%%%%%%%%%%%%%%%%%%% strTo=Request.Form("EMail") '%%%%%%%%%%%%%%%%%%%%%%%%%%%% ' The following line is the subject of the e-mail. You can change ' this to a subject that is customized to your liking. '%%%%%%%%%%%%%%%%%%%%%%%%%%%% strSubject = "Send to E-mail and Database" '%%%%%%%%%%%%%%%%%%%%%%%%%%%% ' The following lines create the body of the message. This can be ' anything you want it to be. '%%%%%%%%%%%%%%%%%%%%%%%%%%%% strBody="The following information was submitted:" & Chr(13) strBody = strBody & Request.Form("FirstName") & " " strBody = strBody & Request.Form("LastName") strBody = strBody & Chr(13) & Request.Form("Address") & Chr(13) strBody = strBody & Request.Form("City") & Chr(13) strBody = strBody & Request.Form("Region") & Chr(13) strBody = strBody & Request.Form("PostalCode") & Chr(13) strBody = strBody & Chr(13) & "Thank you for submitting your data." '============================================= ' The SET statement creates the CDONTS mail object in preparation ' for sending the e-mail message. '============================================= Set myCDONTSMail = CreateObject("CDONTS.NewMail") '============================================= ' The following line sends the mail message using the source e-mail, ' destination e-mail, subject, and body that were defined earlier. '============================================= myCDONTSMail.Send strFrom,strTo,strSubject,strBody '=== Set the CDONTS mail object to NOTHING to free resources. Set myCDONTSMail = Nothing '%%%%%%%%%%%%%%%%%%%%%%%%%%% ' For information about how to customize the rest of this page, see the ' Customizing the Confirmation Page section of this document. Sections ‘ that are discussed in the Customizations section are delimited ' by percent signs. '%%%%%%%%%%%%%%%%%%%%%%%%%%%% %> < /head> < body bgcolor="#FFCC99"> < p>< font face="Verdana" color="#FF0000">< b>Thank you for submitting your information!< br> < /b>< /font>< font face="Verdana" size="2">You will receive an e-mail shortly. The e-mail was sent using the following information:< /font>< /p> < b>< b>< font face="Verdana" size="2">Sent To: < br> From : Microsoft PSS Sample Page< /font>< /b>< /p> < p>< b>< font face="Verdana" size="2">Subject: Send to Database and E-mail< /font>< /b>< /p> < p>< b>< font face="Verdana" size="2">Content: < % '%%%%%%%%%%%%%%%%%%%%%%%%%% ' Call the ParseBody function and pass the strBody string to it. ' This will replace the Chr(13) characters with tags in the HTML. Response.Write(ParseBody(strBody)) '%%%%%%%%%%%%%%%%%%%%%%%%%%%% %> < /font>< /b>< /p> < hr noshade size="1" style="color: #000000"> < p> < /p> < /body> < /html> --------------------------------------------------------------------- Also, How do I connect the script to the add button AFTER the form validation is done... code:---------------------------------------------------------------- < form name="EW_this" onSubmit="return EW_checkMyForm(this);" action="tab_CTS_informationadd.asp" method="post"> < input type="hidden" name="a" value="A"> < input type="submit" name="Action" value="ADD"> < /form> --------------------------------------------------------------------- |
|
#2
|
||||
|
||||
|
Its a functional CDONTS script... However, CDONTS is being depreciated, so you might want to just use CDO and the NewMail object.
As for connecting the script, not sure what you mean. Are you using Javascript or asp to validate your form? If javascript, you'll have your validation happen before the submit actually occurs, so there's no problem. If asp, you just do the validation first, and have it kick back the error if the validation fails, before the email is sent. HTH |
|
#3
|
||||
|
||||
|
Do you mean use:
Code:
Set myCDOMail = CreateObject("CDO.NewMail")
Instead of this: Code:
Set myCDONTSMail = CreateObject("CDONTS.NewMail")
Is that the ONLY change for CDO? |
|
#4
|
||||
|
||||
|
yes
|
|
#5
|
||||
|
||||
|
i just found out that the server uses jmail...
dimac no longer (since may 15 2002) provides a free version of jmail. I am wondering where i can get an older version (4.1 or 4.2) and how to set it up porperly on a local host? thanks ~ ![]() |
|
#6
|
||||
|
||||
|
http://tech.dimac.net/
There is a free version of the jmail component on their site, with somewhat limited functionality, but it should be sufficient to see how it works. The manual is also online |
|
#7
|
||||
|
||||
|
it's shareware
|
|
#8
|
||||
|
||||
|
So? You just need to see how to set it up and test it a couple times, dont you? Then upload to the server and you're good. Its just a mail component, not too much to figure out.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > email script and application thereof... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|