Knowledgebase

Can I use ASP Components such as CDONTS, ADONTS, CDO and others on my package?

These components are available, but do require ASP.net. Therefore you must be using a Windows hosting package to take advantage of them - they are unsupported by Sun One ASP. An example CDONTS script would consists of: <% Set myCDONTSMail = CreateObject("CDONTS.NewMail") Dim myCDONTSMail Dim strFrom Dim strTo Dim strSubject Dim strMessage strFrom="[email protected]" strTo="[email protected]" strSubject = "Mail sent by CDONTS" strBody= "Test message .. please ignore" myCDONTSMail.Send strFrom,strTo,strSubject,strBody Set myCDONTSMail = Nothing %> An example CDO script to send mail would be: <% Dim strEmailAddress, MajorFile, SmtpUser, SmtpPass strEmailAddress="[email protected]" MajorFile="<h1>Hello</h1>" Set cdoConfiguration = Server.CreateObject ("CDO.Configuration") With cdoConfiguration \ .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Fields.Update End With Set myMail=CreateObject("CDO.Message") \ myMail.Configuration = cdoConfiguration myMail.Subject = "Subject Here" myMail.From = "[email protected]" \ myMail.To = strEmailAddress myMail.HTMLBody = MajorFile \ myMail.Send set myMail=nothing set cdoConfiguration = nothing %> A sample CDO script using authenticated SMTP (recommended): <!-- #include file="../inc/config.asp" --> <% ' where ../inc/config.asp provides: ' \ - SmtpPass: SMTP Password (plain text string) ' - SmtpUser: SMTP Username e.g. "[email protected]" ' - SmtpServer: SMTP Server e.g. "mail.example.com" Dim strEmailAddress, MajorFile strEmailAddress="[email protected]" MajorFile="<h1>Hello</h1>" Set cdoConfiguration = Server.CreateObject ("CDO.Configuration") With cdoConfiguration \ .Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SmtpPass .Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = SmtpUser .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SmtpServer .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Fields.Update End With Set myMail=CreateObject("CDO.Message") \ myMail.Configuration = cdoConfiguration myMail.Subject = "Subject Here" myMail.From = "[email protected]" \ myMail.To = strEmailAddress myMail.HTMLBody = MajorFile \ myMail.Send set myMail=nothing set cdoConfiguration = nothing %> 

Was this answer helpful?

Also Read