Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: User code has thrown an exception... Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 14 July 2014 at 12:01pm | IP Logged Quote juris

Hello Support,

Sending an email (PEC) with 15 attachments total 40 MB sending crashes and this error appears:

==================================
User code has thrown an exception. InnerException message follows: '-29' non è un valore valido per 'Value'. 'Value' deve essere compreso tra 'minimum' e 'maximum'.
Nome parametro: Value


Server stack trace:
   in a.a6.a(Delegate A_0, Object[] A_1)
   in a.a.n.a(MailMessage A_0, Int32 A_1, Int32 A_2, Int32 A_3)
   in a.a.n.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)
   in a.a.n.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)
   in a.a.d.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)
   in a.a.m.a(MailMessage A_0, String A_1, EmailAddressCollection A_2, DeliveryNotificationOptions A_3, Smtp8bitDataConversion A_4, Boolean A_5, SendFailureThreshold A_6, Int32 A_7, t A_8, Boolean A_9, DataTable A_10, Int32 A_11, String A_12)
   in a.a.o.a(String A_0, EmailAddressCollection A_1)
   in a.a.o.a(Boolean A_0, String A_1, EmailAddressCollection A_2)
   in System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   in System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   in System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:

============================================

Regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 15 July 2014 at 2:10am | IP Logged Quote Igor

Try commenting out the code you have in event handlers, as a failure seems to occur somewhere there.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 16 July 2014 at 2:23pm | IP Logged Quote juris

Hello Igor,

Download this zip file (40MB): http://www.juris.it/Aggiornamento/Test.zip
After downloading send an email with all attachments.

After 2 minutes you see this exception: InnerException message follows: '-29' is not a valid value for 'Value'. 'Value' should be between 'minimum' and 'maximum'. Parameter name: Value


How can I fix this error?



Regards, Lello
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 17 July 2014 at 3:08am | IP Logged Quote Igor

Thank you. The issue is not reproduced though. I've used the following code:

Code:
MailBee.Global.LicenseKey = "MN800-****-****";
Smtp mailer = new Smtp();
mailer.Log.Enabled = true;
mailer.Log.Filename = @"c:\temp\log.txt";
mailer.Log.Clear();
mailer.From.AsString = "sender@domain.com";
mailer.To.AsString = "recipient@domain.com";
mailer.Subject = "Test With Attachments";
mailer.BodyPlainText = "A lot of files were attached here!";
foreach (string file in Directory.GetFiles(@"c:\temp\files\"))
{
    mailer.AddAttachment(file);
}
mailer.SmtpServers.Add("mail.domain.com", "sender@domain.com", "PaSsWoRd");
mailer.SmtpServers[0].SmtpOptions = ExtendedSmtpOptions.NoChunking;
mailer.Send();


And c:\temp\files\ is the directory the archive was extracted to. It took a while but the message was sent out and arrived to the recipient just fine. See if the code works for you, as it still looks like the issue is specific to your own code.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 17 July 2014 at 4:20am | IP Logged Quote juris

Hello Igor,

I use SMTP With TLS / SSL

Please try again in this way:

// Create an instance of SmtpServer object.
SmtpServer server = new SmtpServer();

server.Name = "*****.***.*****.**"
server.AuthMethods = AuthenticationMethods.Auto;
server.AuthOptions = AuthenticationOptions.PreferSimpleMethods;
server.AccountName = "*****@***.*****.**";
server.Password = "my-SmtpPassword";
server.Port = 465;
server.SslMode = SslStartupMode.OnConnect;
server.Timeout = 70000;
server.SmtpOptions = ExtendedSmtpOptions.NoChunking;

//Add to Mailler...
mailer.SmtpServers.Add(server);

I am a suspect:
It could be the progress bar?
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 17 July 2014 at 4:24am | IP Logged Quote Igor

I can't use that server if I don't have an account there.

And yes, this looks like the problem with handling events, progress bar is a typical case of that.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 17 July 2014 at 4:47am | IP Logged Quote juris

Hello Igor,

You can try another server with TLS / SSL ?

=====================
NOTE: I wrote by mistake my credentials. Please can you delete from the forum?
Back to Top View juris's Profile Search for other posts by juris
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 17 July 2014 at 4:49am | IP Logged Quote Igor

Quote:
You can try another server with TLS / SSL ?


I can try that later. But I'm 200% sure this is unrelated to the actual problem. It just can't cause the error message you quoted earlier.

Quote:
I wrote by mistake my credentials. Please can you delete from the forum?


Sure, done.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 17 July 2014 at 5:22am | IP Logged Quote juris

Hello Igor,

This try-catch solves the problem...


======================================
    // MessageDataChunkSent event handler. Fires each time a chunk
    // of the message data is being sent to the server.
    private void OnMessageDataChunkSent(object sender, SmtpMessageDataChunkSentEventArgs e)
    {
        int percent;


      ////
      // omissis....
      ////


     //This try-catch solves the problem
     try
     {
        // Update progress bar.
        progressBarSending.Value = percent;
     }
     catch { }
    }
Back to Top View juris's Profile Search for other posts by juris
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide