| Author |  | 
      
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          Hi
           | Posted: 16 November 2007 at 11:03am | IP Logged |   |  
           | 
 |  
 I am using MailBee.NET SMTP with Exchange 2003 SP2 as SMTP-Server.  When I try to send an email with an attachment larger than approx. 5 MB I always get the following exception:
 
 MailBee.MailBeeSocketTimeoutException: Socket connection has timed out. InnerException message follows:A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
 at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
 at r.a(Byte[] A_0, Int32 A_1, Int32 A_2)
 --- End of inner exception stack trace ---
 at r.a(Exception A_0)
 at r.a(Byte[] A_0, Int32 A_1, Int32 A_2)
 at b7.a(Byte[] A_0, Int32 A_1, Int32 A_2)
 at dj.af()
 at a.a(MailMessage A_0, String A_1, EmailAddressCollection A_2, DeliveryNotificationOptions A_3, Smtp8bitDataConversion A_4, Boolean A_5, EmailAddressCollection A_6, EmailAddressCollection A_7, Boolean A_8, Boolean A_9, DataTable A_10, Int32 A_11, String A_12)
 at a.a(MailMessage A_0, String A_1, EmailAddressCollection A_2, DeliveryNotificationOptions A_3, Smtp8bitDataConversion A_4, Boolean A_5, SendFailureThreshold A_6, Boolean A_7, DataTable A_8, Int32 A_9, String A_10)
 at bw.a(MailMessage A_0, String A_1, EmailAddressCollection A_2, DeliveryNotificationOptions A_3, Smtp8bitDataConversion A_4, Boolean A_5, SendFailureThreshold A_6, Boolean A_7, DataTable A_8, Int32 A_9, String A_10)
 at cc.a(String A_0, EmailAddressCollection A_1)
 at cc.a(Boolean A_0, String A_1, EmailAddressCollection A_2)
 bei MailBee.SmtpMail.Smtp.Send(String senderEmail, String recipientEmails)
 
 (Exactly the same happens if the sum of the sizes of all attachments is larger than approx. 5 MB.) When I am sending smaller mails  or using a different mail-server everyhing works fine.
 It shouldn’t be the fault of the mail-server, though, because I can send mails larger than 5 MB when I am using Outlook Express or Thunderbird as mail-client.
 
 Can you help me with this issue?
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          First, please make sure you're using recent version of MailBee.NET Objects. It should be 3.x.0.7x. You can download it from our web site (you should uninstall your existing version first).
           | Posted: 17 November 2007 at 7:33am | IP Logged |   |  
           | 
 |  
 If it does not help, set Global.SafeMode=true in the beginning of your code to disable all performance extensions (such as ESMTP CHUNKING extension). Some servers do not support them desptite them claim they do. Often, this is not the bug in these servers but the bug in firewall/antivirus software which monitors all the SMTP traffic.
 
 Furthermore, I would recommend you to check how things are going when there is no firewall/antivirus running. Outlook Express and other popular email clients are often excluded from monitoring and thus any issues with firewall/antivirus/antispam may not appear.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          Thanks for your quick response, but I am afraid it didn’t resolve the issue.
           | Posted: 20 November 2007 at 1:53am | IP Logged |   |  
           | 
 |  
 I used Exchange Server 2003 (no SP) on a clean Windows Server 2003 machine (Enterprise Edition). I didn’t install anything else. (Neither firewall nor antivirus nor anything else.) No problems with MailBee here.
 
 Then I installed  Windows Server 2003 SP 2  and Exchange Server 2003 SP 2. From this time on I was not able to send e-Mails larger then aprox. 5MB through MailBee SMTP (I tested Version 3.0.1.74 and 3.0.1.70). Other Mail-Clients (Thunderbird, Outlook Express)  or  System.Net.Mail had no problems.
 
 Setting  MailBee.Global.SafeMode = true didn’t change anything.
 
 greetings,
 scotty
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Well, Windows Server 2003 itself is equipped with a firewall which is enabled by default and it's very restrictive. Even IIS itself can acts a kind of firewall (max request and response size limits, etc).
           | Posted: 20 November 2007 at 6:43am | IP Logged |   |  
           | 
 |  
 Are you using MailBee in a web application?
 
 Perhaps, the system just cuts off any connection if the amount of data transferred exceeds 5MB. Maybe, the same will occur if you try to send 10MB of data using HTTP to the client browser.
 
 You should check if this is a case. I would also check the system logs, they may contain some useful information too.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          Thank you for your prompt answer.
           | Posted: 20 November 2007 at 8:29am | IP Logged |   |  
           | 
 |  
 MailBee ist not used in a web application and I could not find any useful hints in the system logs.
 
 But here are some facts, that might be useful to reproduce the bug:
 - The Test-Application using MailBee is running on the same server than Exchange 2003 with SP 2.
 - I tried also other mail components like devBiz.Net.Mail, System.Net.Mail or ActiveUp, which was also ok with attachments much larger than 5 MB.
 - There are no limits and filters set for sending or receiving mails.
 - The Exchange Feature IMF (Inteligent Mail Filter) is not activated
 - No AntiSpam, AntiVirus or Firewall is running.
 - Operating System is Windows Server 2003 Enterprise Edition with Service Pack 2.
 
 Please I need help in this case, because my customers are realy getting nervous about this case.
 
 Regards,
 scotty
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          What's in MailBee log? You can enable it using Smtp.Log property.
           | Posted: 20 November 2007 at 9:08am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Also, can we get a test account on your server so that we would be able to send a large mail and reproduce the problem? You can send such info using our Support Form.
           | Posted: 20 November 2007 at 9:17am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          One more thing. Does the problem reproduce when you run your application on another computer? I.e. when it connects to the same server but from another workstation.
           | Posted: 20 November 2007 at 9:19am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          The problem can only be reproduced if the application using MailBee runs on the same server that has Exchange 2003 SP2 installed. I can not reproduce the problem when the application is running on a client machine.
           | Posted: 21 November 2007 at 12:47am | IP Logged |   |  
           | 
 |  
 Here the logfile (abbreviated):
 
 [08:47:27.79] [INFO] Assembly version: 3.0.1.74.
 [08:47:27.57] [INFO] Will resolve host "localhost".
 [08:47:28.54] [INFO] Host "localhost" resolved to IP address(es) 127.0.0.1.
 [08:47:28.56] [INFO] Will connect to host "localhost" on port 25.
 [08:47:29.45] [INFO] Socket connected to IP address 127.0.0.1 on port 25.
 [08:47:29.70] [RECV] 220 test06.test Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Wed, 21 Nov 2007 08:47:28 +0100 \r\n
 [08:47:29.75] [INFO] Connected to mail service at host "localhost" on port 25 and ready.
 [08:47:30.73] [INFO] Will send Hello command (HELO or EHLO).
 [08:47:31.10] [SEND] EHLO test.at\r\n
 [08:47:31.10] [RECV] 250-test06.test Hello [127.0.0.1] \r\n250-TURN\r\n250-SIZE\r\n250-ETRN\r\n250-PIPELINING\r\n25 0-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-8bitmime\r\n250-BINA RYMIME\r\n250-CHUNKING\r\n250-VRFY\r\n250-X-EXPS  GSSAPI NTLM LOGIN\r\n250-X-EXPS=LOGIN\r\n250-AUTH GSSAPI NTLM  LOGIN\r\n250-AUTH=LOGIN\r\n250-X-LINK2STATE\r\n250-XEXCH50\r \n250 OK\r\n
 [08:47:36.57] [INFO] SMTP Hello completed.
 [08:47:36.57] [INFO] Will login as "test".
 [08:47:36.79] [INFO] Will try SASL NTLM authentication method.
 [08:47:36.81] [SEND] AUTH NTLM\r\n
 [08:47:37.03] [RECV] 334 NTLM supported\r\n
 [08:47:37.07] [SEND] TRTVNTAAAoIAAAAAAAAAAAAAAAAAAAAAAAA=\r\n
 [08:47:37.10] [RECV] 334  TlRMVNTACAAAAAAAAADgAAAACgArD7NDF12QAAAAAAAAAAAAAAAA4AAAALDg AAAA8=\r\n
 [08:47:37.26] [SEND]  TlRMTTUAADAAAAAYAEAAAAABgAWAAAAAAAAAAwAAAAAEAHAAAAAAAAAAQAAA AAAABDAAAAAoIAAMJ6l3V7fI/I26zskv9PQT2pSZs9nsasmAa/b5LnRlc3Q= \r\n
 [08:47:37.37] [RECV] 235 2.7.0 Authentication successful.\r\n
 [08:47:37.37] [INFO] Logged in as "test".
 [08:47:37.37] [INFO] Will send mail message to SMTP server "localhost".
 [08:47:47.48] [INFO] Will submit sender and recipients.
 [08:47:52.09] [SEND] MAIL FROM:<test@test.at>\r\n
 [08:47:52.29] [SEND] RCPT TO:<test@testaccount.at>\r\n
 [08:47:53.03] [RECV] 250 2.1.0 test@test.at....Sender OK\r\n
 [08:47:53.03] [RECV] 250 2.1.5 test@testaccount.at \r\n
 [08:47:53.03] [INFO] Sender and recipients accepted by SMTP server. Will send message data now.
 [08:47:53.03] [SEND] BDAT 8192\r\n
 [08:47:53.03] [SEND] [Data chunk of 8192 bytes sent.]
 
 
 [ .... repeats approx. 814 times ...]
 
 
 
 [08:47:56.48] [SEND] BDAT 8192\r\n
 [08:47:56.48] [SEND] [Data chunk of 8192 bytes sent.]
 [08:47:56.48] [SEND] BDAT 8192\r\n
 [08:47:56.48] [SEND] [Data chunk of 8192 bytes sent.]
 [08:49:02.20] [INFO] Error: Socket connection has timed out. InnerException message follows: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
 [08:49:28.06] [INFO] Will disconnect from host "localhost".
 [08:49:32.28] [INFO] Disconnected from host "localhost".
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          And how the log changes in the case of Global.SafeMode=true?
           | Posted: 21 November 2007 at 7:00am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          With MailBee.Global.SafeMode = true; the logfile looks like this:
           | Posted: 22 November 2007 at 1:33am | IP Logged |   |  
           | 
 |  
 [10:07:22.89] [INFO] Assembly version: 3.0.1.74.
 [10:07:22.87] [INFO] Will resolve host "localhost".
 [10:07:23.00] [INFO] Host "localhost" resolved to IP address(es) 127.0.0.1.
 [10:07:23.00] [INFO] Will connect to host "localhost" on port 25.
 [10:07:23.14] [INFO] Socket connected to IP address 127.0.0.1 on port 25.
 [10:07:23.17] [RECV] 220 gfa06.test Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Thu, 22 Nov 2007 10:07:23 +0100 \r\n
 [10:07:23.17] [INFO] Connected to mail service at host "localhost" on port 25 and ready.
 [10:07:23.43] [INFO] Will send Hello command (HELO or EHLO).
 [10:07:23.45] [SEND] EHLO test.at\r\n
 [10:07:23.45] [RECV] 250-test06.test Hello [127.0.0.1] \r\n250-TURN\r\n250-SIZE\r\n250-ETRN\r\n250-PIPELINING\r\n25 0-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-8bitmime\r\n250-BINA RYMIME\r\n250-CHUNKING\r\n250-VRFY\r\n250-X-EXPS  GSSAPI NTLM LOGIN\r\n250-X-EXPS=LOGIN\r\n250-AUTH GSSAPI NTLM  LOGIN\r\n250-AUTH=LOGIN\r\n250-X-LINK2STATE\r\n250-XEXCH50\r \n250 OK\r\n
 [10:07:23.51] [INFO] SMTP Hello completed.
 [10:07:23.51] [INFO] Will login as "test".
 [10:07:23.53] [INFO] Will try SASL LOGIN authentication method.
 [10:07:23.53] [SEND] AUTH LOGIN\r\n
 [10:07:23.53] [RECV] 334 VXNvcm5acWU6\r\n
 [10:07:23.76] [SEND] ********\r\n
 [10:07:23.76] [RECV] 334 UGFlc8dffmQ7\r\n
 [10:07:23.76] [SEND] ********\r\n
 [10:07:23.78] [RECV] 235 2.7.0 Authentication successful.\r\n
 [10:07:23.78] [INFO] Logged in as "test".
 [10:07:23.78] [INFO] Will send mail message to SMTP server "localhost".
 [10:07:41.90] [INFO] Will submit sender and recipients.
 [10:07:43.42] [SEND] MAIL FROM:<test@test.at>\r\n
 [10:07:43.43] [SEND] RCPT TO:<test@testaccount.at>\r\n
 [10:07:43.50] [RECV] 250 2.1.0 test@test.at....Sender OK\r\n
 [10:07:43.54] [RECV] 250 2.1.5 test@testaccount.at \r\n
 [10:07:43.57] [INFO] Sender and recipients accepted by SMTP server. Will send message data now.
 [10:07:43.64] [SEND] BDAT 8192\r\n
 [10:07:43.67] [SEND] [Data chunk of 8192 bytes sent.]
 
 [ .... repeats 780 times ...]
 
 [10:07:47.48] [SEND] BDAT 8192\r\n
 [10:07:47.48] [SEND] [Data chunk of 8192 bytes sent.]
 [10:08:48.82] [INFO] Error: Socket connection has timed out. InnerException message follows: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
 [10:08:49.25] [INFO] Will disconnect from host "localhost".
 [10:08:49.26] [INFO] Disconnected from host "localhost".
 
 
 With MailBee.Global.SafeMode set to false 814 BDAT chunks are sent before the timeout occurs. When MailBee.Global.SafeMode is set to true the application times out a little earlier (after only 780 BDAT Chunks).
 
 I tried this several times and it seems to me that the number of BDAT Chunks sent before the timeout occurs is otherwise constant.
 
 greetings,
 scotty
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Hey, that's weird. Are you sure you're setting Global.SafeMode=true in the beginning of your code? Maybe you set it after SmtpServer instance has already been created? BDAT cannot be issued in safe mode, MailBee will send DATA in this case, not BDAT.
           | Posted: 22 November 2007 at 5:10am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          MailBee.Global.SafeMode is set before an instance of SmtpServer is created. To make sure i am doing nothing wrong, I sent you the code i am testing on using your Supportform.
           | Posted: 22 November 2007 at 6:42am | IP Logged |   |  
           | 
 |  
 Regards,
 Scotty
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Thanks for the code. You're indeed setting Global.SafeMode prior to creating instance of SmtpServer but then you set SmtpServer.SmtpOptions back to the default value thus cancelling effect of SafeMode. SafeMode affects the default value of SmtpServer.SmtpOptions. Thus, if you set SmtpOptions manually, Global.SafeMode will not have any effect on this.
           | Posted: 22 November 2007 at 6:57am | IP Logged |   |  
           | 
 |  
 Alternatively, you can simply disable CHUNKING (it causes BDAT to be sent) if you're anyway setting SmtpOptions manually:
 
 mySMTPOptions = ExtendedSmtpOptions.NoChunking
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | scotty Newbie
 
  
 
 Joined: 27 August 2007
 Online Status: Offline
 Posts: 25
 | 
          I followed your advice enabling Global.SafeMode without setting any other options and suddenly everything worked fine - i.e. I can send mails larger than 5mb. (In the log-file BDAT has been replaced by DATA as predicted.)
           | Posted: 23 November 2007 at 1:32am | IP Logged |   |  
           | 
 |  
 Disabling SafeMode again, I experimented a little bit with the settings:
 With ExtendedSmtpOptions.NoChunking everything works fine.
 
 It also found out that it works when I just set Pipelining to false. (BDAT is used.)
 
 I think, I can work with these options for now.
 Thanks for your help.
 
 
 Best Regards,
 Scotty
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Thanks a lot for the valuable feedback.
           | Posted: 23 November 2007 at 2:58am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Chris S Newbie
 
  
  
 Joined: 14 December 2010
 Location: Australia
 Online Status: Offline
 Posts: 4
 | 
          The thing is... if you are using pipelining and chunking, the server won't respond till it finishes getting a BDAT <size> LAST.
           | Posted: 14 December 2010 at 11:38pm | IP Logged |   |  
           | 
 |  
 If the data is large enough and it takes long enough, the socket that you establish will eventually timeout. Is there a way of configuring the socket timeout in mailbee? What is the default?
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6167
 | 
          The property is SmtpServer.Timeout, default value is DefaultTimeout.
           | Posted: 14 December 2010 at 11:49pm | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |