Solved

CDO error - CDO.Message.1 error '8004011b  err.number -2147221221

Posted on 2011-03-22
3
1,875 Views
Last Modified: 2012-06-21
Hi I'm having a strange issue with IIS 7.  I just moved an app from IIS 6 on one server to IIS 7 on another.  It was working in IIS 6 just fine.

Now I am getting an error message when trying to send via cdo using the virtual smtp tool.

From the err object:
err.number: -2147221221
err: Unknown Error

The Hard Error:
CDO.Message.1 error '8004011b'
Unknown Error
/quote_email_create.asp, line 198

The error seems to only occur at random... the customer sees the error, but when I go in and test, everything works fine.

I'm not sure where the best way to proceed is since I cannot get the error to occur, but I've seen a screencast and it most certainly is failing when the customer runs the script.  The only difference I can tell, is the from addresses, but when I log in with his account, it still works fine.
Is there anything in my cdo code I can change to prevent the error above?  

if request("Action") & "" <> "Send Me a Proof" then
		strTo=request.form("ToEmail") & ""
		strBCC=session("UserEmail") & ""
		
	else
		strTo=session("UserEmail") & ""
		strBCC=""
		
	end if
	strSubject = request.form("txtSubject") & " "
	
	strBCC=session("UserEmail") 


	strBody=""
        '''' strBody has a text from a textarea, wrapped in html... i omitted this in this sample for privacy sake, but if it could be related to the issue, let me know.
	
	lngImportance = 1
	'strCC=request.form("txtCC")


CdoBodyFormatText = 1
CdoBodyFormatHTML = 0
CdoMailFormatText = 1
cdoOutlookExvbsss = 2
cdoIIS = 1

	'use CDO
	On error resume next
	Set Message = Server.CreateObject("CDO.Message")
	
	if isObject(Message) then
		
	With Message
		.Configuration.Load cdoIIS
		bodyString = "<font face=Arial size=2 color=#000080>" & strBody & "<br><br>" 
		.To = strTo
		.Subject = strSubject
		.htmlbody= bodyString
		.Bcc = strBCC
		'.HTMLText	= true

		
		if Len(strFrom) > 0 Then .From = strFrom
		
		.Send
	End With
if err.number <> 0 then
	response.write "err.number: " & err.number & "<BR>"
	response.write "err: " & err.description & "<BR>"

else	
		if request("Action") & "" <>"Send Me a Proof" then
		
			response.Write "<br><br><br><br><br><br><center><font size=3><b>Your e-mail has been sent to " & strTo & ".</b></font></center>"
			response.write "<BR><BR><BR><BR>"
			response.write "<a href=""quote_view.asp?QuoteID=" & thisQuote & """>Return to Quote</a>"
						
			
			'update quote status
			uSQL = "Update Quotes Set QuoteStatus='Quoted/Email Sent' Where QuoteID = " & thisQuote
			Conn.execute(uSQL)
			
			
		else
			response.Write "<br><br><br><br><br><br><center><font size=3><b>Your proof e-mail has been sent to " & strTo & ".<BR><BR>  <a href=""javascript:history.go(-1)"">Go Back to Form to send real mail to customer</a></b></font></center>"
			response.write "<BR><BR>or<BR><BR>"
			response.write "<a href=""quote_view.asp?QuoteID=" & thisQuote & """>Return to Quote</a>"
			
		end if


		
end if

response.write "<br><br>email to: " & strTo & "<BR>"
response.write "email from: " & strFrom & "<BR>"
response.write "Preview:<hr>"
response.write bodyString

	end if ' We could send an Email

Open in new window

0
Comment
Question by:Robert Hamel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
pcsmitpra earned 250 total points
ID: 35190322
On Windows 2008 under IIS 7 , You can run SMTP with default setup, You only need to change Access tab ->Relay Restrictions, select the radio button "Only the list below" and there you can add the IPAddress or IP range of machines that you want to send emails from this server.
And under Delivery -> Advance  -> Mention  FQDN for the domain name or server name in question. If this server is part of Example.com Active directory domain, then you can create an MX record in DNS. So you may check these few settings.
0
 

Assisted Solution

by:Robert Hamel
Robert Hamel earned 0 total points
ID: 35190860
I actually had all of this configured already... and still had those problems I mentioned at random.
I have made progress by modifying the code to use an SMTP server instead of the local IIS pickup and now the script is working.  Not sure why the other wasn't working, as the setup is the same as it was on the server I moved from.  
0
 

Author Closing Comment

by:Robert Hamel
ID: 35225361
using remote smtp resulted in success where other solutions did not.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Logparser is the smartest tool I have ever used in parsing IIS log files and there are many interesting things I wanted to share with everyone one of the  real-world  scenario from my current project. Let's get started with  scenario - How do w…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question