CreateMHTMLBody timeout

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • viktorka
    New Member
    • Jun 2010
    • 26

    CreateMHTMLBody timeout

    The code below works fine on the Win 2K, however, when I run it on the Win 2008 it gives timeout on the
    .CreateMHTMLBod y "http://www.something.c om"
    The rest of the classic asp codes work fine on Win 2008, except this one. It there any additional setting that has to be set on IIS that I'm missing?

    Code:
    <%''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'list of email addresses (separated by coma) is in the strTo 
    
    Function SendEmail(strFrom, strSubject, strBody, strTo) 
    	
    	'set email settings		
    	Const cdoSendUsingPort          = 2
    	Const cdoBasic                  = 1
    	
    	Dim objConfig  ' As CDO.Configuration
    	Dim objMessage ' As CDO.Message
    	Dim Fields     ' As ADODB.Fields
    	
    	' Get a handle on the config object and it's fields
    	Set objConfig = Server.CreateObject("CDO.Configuration")
    	Set Fields = objConfig.Fields
    	
    	' Set config fields we care about
    	With Fields
    		.Item(cdoSendUsingMethod)       = cdoSendUsingPort
    		.Item(cdoSMTPServer)            = "************"
    		.Item(cdoSMTPServerPort)        = 587
    		.Item(cdoSMTPConnectionTimeout) = 10
    		.Item(cdoSMTPAuthenticate)      = cdoBasic
    		.Item(cdoSendUserName)          = "************"
    		.Item(cdoSendPassword)          = "*******"
    		.Update
    	End With
    			
    	Set objMessage = Server.CreateObject("CDO.Message")
    	Set objMessage.Configuration = objConfig
    			
    	With objMessage
    		.From     = strFrom
    		.Subject  = strSubject
    	
    		'set html or text body of the email
    		if lcase(left(strBody,4)) = "http" then
    	       	.CreateMHTMLBody strBody
    	    else
            	.TextBody = strBody
            end if
            
           	EmailList = split(strTo, ",")
            for intCount = 0 to uBound(EmailList) 
    			.To = EmailList(intCount)
    			.Send
    		next
    	End With
    	
    	Set Fields = Nothing
    	Set objMessage = Nothing
    	Set objConfig = Nothing
    	
    	SendEmail = "TRUE"
    
    End Function 
    
    
    %>
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    I find sending mail with asp to be very bothersome, I avoid where possible. I have gotten timeouts in the past when there were more than two or three recipients, and when emails were being blocked. So first off, check if it still times out with very small messages / only one email address.

    Jared

    Comment

    • viktorka
      New Member
      • Jun 2010
      • 26

      #3
      Timeout is not when message is sent (read the post above).
      Timeout is when HTML page is loaded into HTMLBody.

      I have no trouble sending text messages.
      I have no trouble sending HTML messages that are created by asp (not loaded from web).
      I have no problem sending big messages.
      I have no problem sending bulk of messages.

      As I mentioned, the problem is when I attempt to load web page. And this problem is on our new server Win 2008. The old server with Win 2k executes all codes perfectly.

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        It sounds to me like it's not a problem with windows2008 per se, but a permissions or security setting that prevents you from loading the outside file. Do you have "on error resume next" in place? Sometimes this will mask the real problem and only give you a timeout error.

        Jared

        Comment

        • viktorka
          New Member
          • Jun 2010
          • 26

          #5
          Originally posted by jhardman
          It sounds to me like it's not a problem with windows2008 per se, but a permissions or security setting that prevents you from loading the outside file. Do you have "on error resume next" in place? Sometimes this will mask the real problem and only give you a timeout error.

          Jared
          It could be as you said "security setting that prevents from loading the outside file" at least it looks like that.

          I tried vb.ten by using system.web.mail and system.net.mail classes and have run into the same problem on the similar line of code when I attempted to download an online file - Timeout error message.

          If this is a security setting where would you recommend checking it? I tried do the same by turning off firewall - did not helped.

          Comment

          • viktorka
            New Member
            • Jun 2010
            • 26

            #6
            Originally posted by viktorka
            It could be as you said "security setting that prevents from loading the outside file" at least it looks like that.

            I tried vb.ten by using system.web.mail and system.net.mail classes and have run into the same problem on the similar line of code when I attempted to download an online file - Timeout error message.

            If this is a security setting where would you recommend checking it? I tried do the same by turning off firewall - did not helped.
            I think I found the source of a problem. Yet, not sure how to fix it.

            The difference between first server (where CreateMHTMLBody works) and second server (where CreateMHTMLBody does not works)is that on the first one each of website (26 in total) has a unique IP address and on the second one all websites are on the same IP - IIS binding is based on the Host Names. It looks like when CreateMHTMLBody is trying to access a website by it's domain name and this website is on the same server but does not have a unique IP - it times out. It works only when I place a page that CreateMHTMLBody tries to access on the main web site (binding is not based on the host name). In summary I may use CreateMHTMLBody to send pages from only on one of 26 our websites on that server.

            Comment

            • jhardman
              Recognized Expert Specialist
              • Jan 2007
              • 3405

              #7
              I've asked some IIS experts to weigh in, you got me stumped. Your reasoning sounds solid though.

              Jared

              Comment

              • Denburt
                Recognized Expert Top Contributor
                • Mar 2007
                • 1356

                #8
                Originally posted by viktorka
                The code below works fine on the Win 2K, however, when I run it on the Win 2008 it gives timeout on the
                .CreateMHTMLBod y "http://www.something.c om"
                The rest of the classic asp codes work fine on Win 2008, except this one. It there any additional setting that has to be set on IIS that I'm missing?

                Code:
                <%''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                'list of email addresses (separated by coma) is in the strTo 
                
                Function SendEmail(strFrom, strSubject, strBody, strTo) 
                	
                	'set email settings		
                	Const cdoSendUsingPort          = 2
                	Const cdoBasic                  = 1
                	
                	Dim objConfig  ' As CDO.Configuration
                	Dim objMessage ' As CDO.Message
                	Dim Fields     ' As ADODB.Fields
                	
                	' Get a handle on the config object and it's fields
                	Set objConfig = Server.CreateObject("CDO.Configuration")
                	Set Fields = objConfig.Fields
                	
                	' Set config fields we care about
                	With Fields
                		.Item(cdoSendUsingMethod)       = cdoSendUsingPort
                		.Item(cdoSMTPServer)            = "************"
                		.Item(cdoSMTPServerPort)        = 587
                		.Item(cdoSMTPConnectionTimeout) = 10
                		.Item(cdoSMTPAuthenticate)      = cdoBasic
                		.Item(cdoSendUserName)          = "************"
                		.Item(cdoSendPassword)          = "*******"
                		.Update
                	End With
                			
                	Set objMessage = Server.CreateObject("CDO.Message")
                	Set objMessage.Configuration = objConfig
                			
                	With objMessage
                		.From     = strFrom
                		.Subject  = strSubject
                	
                		'set html or text body of the email
                		if lcase(left(strBody,4)) = "http" then
                	       	.CreateMHTMLBody strBody
                	    else
                        	.TextBody = strBody
                        end if
                        
                       	EmailList = split(strTo, ",")
                        for intCount = 0 to uBound(EmailList) 
                			.To = EmailList(intCount)
                			.Send
                		next
                	End With
                	
                	Set Fields = Nothing
                	Set objMessage = Nothing
                	Set objConfig = Nothing
                	
                	SendEmail = "TRUE"
                
                End Function 
                
                
                %>
                I would suggest you verify the following then let us know if it helps to resolve the issue or not.

                I have quoted the following Note from the following link (hope this helps).


                "After you configure a host header or multiple host headers for an IP address, you must register the host headers with the appropriate name resolution system. If your computer is on an intranet, register the host header name or names with the intranet's name resolution system. If your computer is on the Internet, register the host header name or names with the Domain Name System (DNS), which is administered by InterNic."

                Comment

                • viktorka
                  New Member
                  • Jun 2010
                  • 26

                  #9
                  I do not have DNS set at all.
                  IIS binding works pretty fine with all websites I have.
                  I'm not sure if I should install DNS. I can solve my problem by moving all mail files into the main website.
                  Unless there could be other issues that I'm not aware off caused by absence of DNS

                  Comment

                  • Denburt
                    Recognized Expert Top Contributor
                    • Mar 2007
                    • 1356

                    #10
                    Originally posted by viktorka
                    I do not have DNS set at all.
                    IIS binding works pretty fine with all websites I have.
                    I'm not sure if I should install DNS. I can solve my problem by moving all mail files into the main website.
                    Unless there could be other issues that I'm not aware off caused by absence of DNS
                    Yes so many variables and possibilities as to how things are set up and can be set up it can be really hard to find a solution to an issue like this on a forum.

                    I don't mind trying though...

                    1. I was wondering if the page you are trying to send might be an asp page such as default.aspx or index.aspx? I have seen issues there before.

                    2. Have you tried sending it as a file verses using the HTTP: syntax? file://somefolder/test.htm You might even try removing the word file and send it as: //somefolder/test.htm

                    3. What kind of authentication are you using on your server? The following article may help you determine if it is security related and has many links to help you with any security related issues.


                    Well that's what I have for now let us know if this helps or if you have any further questions or remarks then we can go from there.

                    Comment

                    Working...