?
Solved

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

Posted on 2011-03-22
3
Medium Priority
?
1,945 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 1000 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

777 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