Solved

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

Posted on 2011-03-22
3
1,854 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
  • 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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