DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

Sending Email using CDOSYS & Classic ASP

This is a discussion on Sending Email using CDOSYS & Classic ASP within the ASP Code Samples forums, part of the ASP Development category; This is an example of sending a simple email using CDOSYS in ASP via a remote mail server Code: Dim ...

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

  4 links from elsewhere to this Post. Click to view. #1  
Old March 17th, 2008, 09:52 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,312
Blog Entries: 5
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default Sending Email using CDOSYS & Classic ASP

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
Reply

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

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


LinkBacks (?)

LinkBack to this Thread: http://www.developerbarn.com/asp-code-samples/19-sending-email-using-cdosys-classic-asp.html

Posted By For Type Date
http 500. Help, my form mail in wrong : The Official Microsoft IIS Site This thread Refback May 20th, 2009 12:16 PM
http 500. Help, my form mail in wrong : The Official Microsoft IIS Site This thread Refback May 11th, 2009 12:32 PM
http 500. Help, my form mail in wrong : The Official Microsoft IIS Site This thread Refback May 11th, 2009 04:33 AM
PolicyCheck - | Pensions | Investments | Savings | Advice This thread Refback April 2nd, 2008 08:53 AM

Similar Threads

Thread Thread Starter Forum Replies Last Post
Sending Emails Using ASP.NET richyrich .Net Code Samples 5 July 6th, 2009 04:21 AM
Sending Email with ASP and CDOSYS jmurrayhead ASP Code Samples 1 November 13th, 2008 09:26 AM
help with email validation Rebelle JavaScript Programming 13 August 21st, 2008 10:57 AM
Classic ASP FAQ jmurrayhead ASP Development 8 April 8th, 2008 10:29 AM


All times are GMT -4. The time now is 02:05 AM.


Copyright ©2008-2009, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2