classic asp - cdonts

To send mail using Classic ASP script you will need to use the built-in email function called CDONTS or CDOSYS. CDOSYS is the recommended way to send email ...

classic asp - cdonts

I'm trying to send an email using classic asp and cdonts on a Windows Server 2003 machine.

But I'm guessing the SMTP service needs to be running. Unfortunately it's asking for teh SP1 disk...which apparently has gone missing. I'm guessing not but is there any other way of doing this?

Thanks,

Conversion from CDONTS to CDOSYS (Microsoft does not support CDONTS)

Switching from CDONTS to CDOSYS couldn't be easier. The following is an example of an ASP script used to send email with CDONTS. Note, that this code is using variables called strTo, strFrom, strSubject and strBody that have either been set previously or posted to this page using a form.

 

<%
Set oMail = CreateObject("CDONTS.NewMail")
oMail.BodyFormat = 0
oMail.MailFormat = 0
oMail.Importance = 2
oMail.AttachFile FbkFile
oMail.to = strTo
oMail.From = strFrom
oMail.Subject = strSubject
oMail.Body = strBody
oMail.Send
Set oMail = Nothing
%>

 

Using CDOSYS we can accomplish the same thing. There is more to CDOSYS than this, but the example shown below should be enough to generate simple email messages. If you need to include HTML tags in your email message, you must use cdoMessage.HTMLBody instead of cdoMessage.TextBody. Note, this script has simple string text directly in code. It is likely you would replace the text with a string variable. See above example.

 

<%
Set myMail=CreateObject("CDO.Message")
    myMail.Subject="This is an email"
    myMail.From="YOUR@EMAIL.COM"
    myMail.To="THEIR@EMAIL.COM"
    myMail.TextBody="Hello world!"
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    'SMTP server
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail.ephost.com"
    'SMTP port
    myMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=465
    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing
%>

 


Click Here to Visit

What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0