Home Contact F.A.Q
Domain Names £9.00
  .
 
 
Welcome
 
Protec Web Solutions Knowledge Base. Knowledgebase Home Page > Active Server Pages (Classic ASP)

Search the Knowledge Base Browse by Category
How do i send email from my ASP pages?

Would you like to...

Print this page
Email this to a friend

The easiest way to send email is by using the CDOSYS component from Microsoft that is installed on your web server. Below is an example of ASP code to do that:

<%
'Dimension variables
Dim objCDOSYSCon

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Out going SMTP server
objCDOSYSCon.Fields("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yoursite.com"

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon

objCDOSYSMail.From = "you@yoursite.com"

objCDOSYSMail.To = "someone@theresite.com"

objCDOSYSMail.Subject = "Subject goes here"

objCDOSYSMail.HTMLBody = "html enhanced email message goes here"

objCDOSYSMail.Send

'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>

The full reference of CDO methods is available at the link below.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_imessage_interface.asp


Related Questions:

Attachments:

No attachments were found.


Protec Web Solutions Knowledge Base. Copyright © 2010 www.protecsupport.com
Powered by AcitveKB Knowledgebase Software
 
 © 2003 Protec Web Solutions Ltd
Privacy Policy     Terms of use
Web Hosting  Resellers   SQL  Development  Applications  FAQ  Testimonials
Prices Exclude VAT which is charged where applicable
Designed By Web Rhino