Link to home
Start Free TrialLog in
Avatar of Robert Hamel
Robert HamelFlag for United States of America

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of pcsmitpra
pcsmitpra
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robert Hamel

ASKER

using remote smtp resulted in success where other solutions did not.