DeveloperBarn Forums

Go Back   DeveloperBarn Forums > Programming & Scripting > Code Samples > Classic ASP

Discuss "Sending Email using CDOSYS & Classic ASP" in the Classic ASP forum.

Classic ASP - Post your Classic ASP code samples here.


Reply « Previous Thread | Next Thread »  
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old March 17th, 2008, 09:52 AM
richyrich's Avatar
Moderator

 
Join Date: Mar 2008
Location: Somewhere only we know...
Posts: 325
Thanks: 22
Thanked 23 Times in 23 Posts
Rep Power: 1
richyrich is on a distinguished road

Awards Showcase
Classic ASP JavaScript 
Total Awards: 2

Default Sending Email using CDOSYS & Classic ASP

Sending Email using CDOSYS and Classic ASP Not relevant for ASP.NET

This is an example of sending a simple email using CDOSYS in ASP via a remote mail server
Code:
Dim mymail
'Create an instance of the CDOSYS Object
set mymail = createobject("CDO.Message")
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail.domain.com" 'this should be changed to the smtp server you have access to
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 'or the port configured for smtp
'you can uncomment the lines below if your mail server requires authentication
'mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
'mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="your_authenticated_user@domain.com" ' this should be the authenticated user who can send emails
'mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="thepassword" ' the password of the authenticated user
 
'update the configuration options
mymail.Configuration.Fields.Update
 
' the email address to send to
mymail.to = "email_address@otherdomain.com"
'if you want to include a name then
'mymail.to = "Firstname Surname <email_address@otherdomain.com>"
 
'the email address to send from
mymail.from = "your_email@domain.com"
'if you want to include a name then
'mymail.from = "Firstname Surname <your_email@domain.com>"
 
'the cc email address to send to
'mymail.cc = "cc_email@ccdomain.com"
 
'the bcc email address to send to
'mymail.bcc = "bcc_email@bccdomain.com"
 
'enter the subject of the email
mymail.subject = "Email Subject"
 
'to send an html email
mymail.HTMLbody = "<b>This is the HTML email body</b>"
'to send a plain text email
mymail.Textbody = "This is the plain text email body"
 
'add an attachment
mymail.AddAttachment server.mappath("/path_to_attachment/file.ext")
 
'send the email
mymail.send
 
'clean the objects
set mymail=nothing

Comments on this post
jmurrayhead agrees: very helpful
AOG123 agrees: Very Good

Last edited by richyrich; April 2nd, 2008 at 08:22 AM.
Reply With Quote
Sponsored Links
Reply

  DeveloperBarn Forums > Programming & Scripting > Code Samples > Classic ASP

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.developerbarn.com/classic-asp/19-sending-email-using-cdosys-classic-active-server-pages.html
Posted By For Type Date
PolicyCheck - | Pensions | Investments | Savings | Advice This thread Refback April 2nd, 2008 08:53 AM


Sponsored Links

ASP.NET Resource Index
a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer.

Free Web Directory
Including Chats and Forums Resources, Offer automatic, instant and free directory submissions.
URLZ Web Directory
URLZ Web Directory

Free Web Directory - Add Your Link
The Little Web Directory
Free Web Directory
Pegasus free web directory is a free directory organised by categories.

Web Directory & SEO Services
dirroot web directory


All times are GMT -4. The time now is 10:50 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2008 DeveloperBarn.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46