Cdo Error Message
Contents |
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. cdo message error handling The content you requested has been removed. You’ll be auto redirected in 1 second. could not access cdo message object Collaboration and Messaging CDO for Windows 2000 Reference Reference Error Codes Error Codes Error Codes COM Classes Enumerated Values Fields Interfaces cdo message send error Modules Error Codes TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Error Codes
Cdo Message Properties
Exchange Server 2003 Topic Last Modified: 2004-06-08   Error Codes This section contains the custom error codes used by Microsoft CDO for Windows 2000. All of these values are available as constants in the type library CdoErrorCodes module. Error values are 32 bit values whose structure is depicted here: Copy 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 cdo message error handling vbscript 1 1 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +---+-+-+-----------------------+-------------------------------+ |Sev|C|R| Facility | Code | +---+-+-+-----------------------+-------------------------------+ Reading this depiction from left-to-right, the severity code, Sev, is one of the following values: 00 - Success 01 - Informational 10 - Warning 11 - Error Followed by: C — The customer code flag. R — A reserved bit. Facitlity — The facility code. Code — The facilitiy's status code. Error Name Value Remarks CDO_E_UNCAUGHT_EXCEPTION 0x80040201L Exception %1 was generated at address %2 CDO_E_NOT_OPENED 0x80040202L No data source has been opened for the object. CDO_E_UNSUPPORTED_DATASOURCE 0x80040203L The object does not support this type of data source. CDO_E_INVALID_PROPERTYNAME 0x80040204L The object does not support the requested property name or namespace. CDO_E_PROP_UNSUPPORTED 0x80040205L The object does not support the requested property. CDO_E_INACTIVE 0x80040206L The object is not active. It may have been deleted or it may not have been opened. CDO_E_NO_SUPPORT_FOR_OBJECTS 0x80040207L The object does not support storing persistent state information for objects. CDO_E_NOT_AVAILABLE 0x80040208L The requested property or feature, while supported, is not available at this time or in this context. CDO_E_NO_DEFAULT_DROP_DIR 0x80040209L No def
Set objMessage = CreateObject("CDO.Message") then fill-in Sender, Subject and Recipient (To) fields of the headers and the body text which can be either plain text or HTML. You can also add a file attachment. You then use cdo error codes the Send method to send the email. Below I'll show all three types of emails,
Cdo Message Attachment
and how to send an email using a remote SMTP server in the event you are not running your own. I've added and
Cdo Message Createmhtmlbody
example to illustrate how to request a return receipt and delivery status notifications. Please note, when using the AddAttachment method in your scripts you must use a fully qualified pathname as the argument to the method. Using just https://msdn.microsoft.com/en-us/library/ms526287(v=exchg.10).aspx a file name or a relative path will produce the error The specified protocol is unknown. If you receive an error message related to objMessage.From then you should try replacing it with objMessage.Sender I've added sample code to illustrate how to load the body of the email from a text file on your disk. I've added a sample of how to load recipient data from a database. I've added a sample illustrating how to use data from http://www.paulsadowski.com/wsh/cdo.htm Excel in an email. If you are looking for an ASP based email form processor then please look here. If you are interested in a mass mailer using CDO and VBScript, look here. If you find the content of this page useful, please consider making a small donation to show your support and keep the content updated and fresh. This sample sends a simple text email that can be viewed in any email client. Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Example CDO Message" objMessage.From = "me@my.com" objMessage.To = "test@paulsadowski.com" objMessage.TextBody = "This is some sample message text." objMessage.Send Sending an HTML email. Note the use of the Cc & Bcc properties to send using Blind Carbon Copy (Bcc) and Carbon Copy (Cc). These properties can be used with either text or HTML email. Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Example CDO Message" objMessage.From = "me@my.com" objMessage.To = "test@paulsadowski.com" 'The line below shows how to send using HTML included directly in your script objMessage.HTMLBody = "
This is some sample message html.
" 'The line below shows how to send a webpage from a remote site 'objMessage.CreateMHTMLBody "http://www.paulsadowski.com/wsh/" 'The line below shows how to send a webpage from a file on your machine 'objMessage.CreateMHTMLBody "file://c|/temp/test.htm" objMessage.Bcc = "you@your.com" objMessage.Cc = "you2@your.com" objMessage.Send Sending a text email with an attached file. By repeating the .AddAttachment method you can attach more than oto catch problem emails? If this is your first visit, be sure to check out the FAQ by http://www.vbforums.com/showthread.php?520679-Sending-Emails-with-CDO-how-to-catch-problem-emails clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum http://p2p.wrox.com/asp-pro-code-clinic/9830-cdo-email-errors-not-trapped-error.html that you want to visit from the selection below. Results 1 to 3 of 3 Thread: Sending Emails with CDO, how to catch problem emails? Tweet Thread Tools cdo message Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Apr 29th, 2008,04:47 AM #1 VB rookie View Profile View Forum Posts Thread Starter Lively Member Join Date Nov 2006 Posts 105 Sending Emails with CDO, how to catch problem emails? I have an automatic email function cdo message error in my app, and the code looks like: Code: formAllEmails.MousePointer = vbHourglass 'setup for email Set objemail = CreateObject("CDO.Message") objemail.From = emailDisplayName & "<" & emailAddressDB & ">" objemail.To = p_email '*************** 'needs to chang to check type, then send appropriate message '*************** objemail.Subject = "An update on from " & emailDisplayName objemail.TextBody = message objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Name or IP of Remote SMTP Server objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = emailServer 'Type of authentication, NONE, Basic (Base64 encoded), NTLM objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic 'Your UserID on the SMTP server objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername") = emailAddressDB 'Your password on the SMTP server objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = emailPassword 'Server port (typically 25) objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = emailPort 'Use SSL for the connection (False or True) If emailSSL = "1" Then objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True Else objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False End If 'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server) objemail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configur
Unanswered Topics Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Pro Code Clinic CDO Email Errors not trapped by On Error User Name Remember Me? Password Reminder Password Register Register | FAQ | Members List | Calendar | Today's Posts | Search ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here. Search Forums Show Threads Show Posts Advanced Search Find All Thanked Posts Go to Page... Welcome to the p2p.wrox.com Forums. You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free . Thread Tools Display Modes #1 (permalink) February 26th, 2004, 06:04 PM ebycer Registered User Join Date: Feb 2004 Location: , , . Posts: 3 Thanks: 0 Thanked 0 Times in 0 Posts CDO Email Errors not trapped by On Error Hi, I've got a problem where my apps email service is sporadic. Sometimes works like a charm, other times fails miserably. What's supposed to happen is the following: When an e-mail is successfully sent -- exit successfully and do nothing further. When an error occurs on the email Send command 1) Log the error # and description, body, subject, and distribution in a table 2) Generate a message for the user explaining that the e-mail has NOT been sent, but everything else is OK 3) Give them a link to redirect them so they continue as if no error had occurred. Unfortunately, when the e-mail fails, nothing is recorded, nor is the user notified that an error occurred. Any ideas? (Note: Using Access 2000 on Win Server 2003) Here is the code for all three procedures. Sorry if the indentation is messy... Sub Sub_Process_Email_Error(str_Redirect) If str_Redirect <> "myFiles.asp" Then Respo