Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Send an email using ASP

0.00/5 (No votes)
25 Apr 2002 1  
Send email with CDONTS

Introduction

This article shows how to send email from an ASP page using CDONTS Component.

Code snippet

Sub send_email(email_from, email_to, email_subject, email_body)
    Dim Newmail
    Set Newmail = server.CreateObject ("cdonts.newmail")
    
    Newmail.BodyFormat = 0
    Newmail.MailFormat = 0
    Newmail.From = email_from
    Newmail.To = email_to
    Newmail.Subject = email_subject
    Newmail.Body = email_body
    Newmail.Send
    
    Set Newmail = Nothing    
End Sub

To call the procedure:
Call send_email("from@domain.com","to@domain.com","Subject","Body")
If you have any difficulty using CDONTS, it is most often the configuration of the SMTP service on IIS. There is not much that can go wrong with this simple, yet extremely powerful component.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here