Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Here are the symptoms: You start receiving calls from users that one of your legacy web apps isn't coming up, so you log into your IIS 5 server to check it out.  When you pull up the services, you notice that the WWW Publishing service isn't runn…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now