Click here to Skip to main content
15,881,139 members
Articles / Programming Languages / ASP
Article

Send an email using ASP

Rate me:
Please Sign up or sign in to vote.
2.43/5 (7 votes)
25 Apr 2002 114.4K   32   10
Send email with CDONTS

Introduction

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

Code snippet

VBScript
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:
VBScript
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


Written By
Web Developer
Argentina Argentina
Lic. Fernando Finelli

Comments and Discussions

 
QuestionTabs in ASP.NET Pin
rushdynet113-Mar-06 0:46
rushdynet113-Mar-06 0:46 
QuestionHow to set IIS to support CDONTS Pin
alog200510-Nov-05 17:49
alog200510-Nov-05 17:49 
Questionwhat I have to do Pin
Green Eyes24-Apr-05 2:08
Green Eyes24-Apr-05 2:08 
QuestionHow to configure IIS to enable smtp mail Pin
karlim21-Jul-03 18:06
karlim21-Jul-03 18:06 
AnswerRe: How to configure IIS to enable smtp mail Pin
Member 13918719-Oct-03 12:50
Member 13918719-Oct-03 12:50 
AnswerRe: How to configure IIS to enable smtp mail Pin
Anonymous19-Sep-04 21:37
Anonymous19-Sep-04 21:37 
GeneralRe: How to configure IIS to enable smtp mail Pin
juangsyj22-Mar-07 15:48
juangsyj22-Mar-07 15:48 
GeneralRe: How to configure IIS to enable smtp mail Pin
durga21223-Mar-07 21:24
durga21223-Mar-07 21:24 
GeneralAre you going to post.... Pin
27-Apr-02 15:21
suss27-Apr-02 15:21 
GeneralRe: Are you going to post.... Pin
Fernando Finelli28-Apr-02 3:53
Fernando Finelli28-Apr-02 3:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.