-
-
Notifications
You must be signed in to change notification settings - Fork 818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mailkit 2.1.2 + .Net 4.5.2 Error on SmtpClient.Connect #814
Comments
This is the only place MailKit calls MapToIPv4(): https://github.com/jstedfast/MailKit/blob/master/MailKit/Net/Smtp/SmtpClient.cs#L437 However, this is not in the Connect() method so I'm not sure that's the issue. Could you debug this and check if that is the right place? |
Hello,
I don’t know how to force VS 2017 to use 4.5 framework for debug. And I cant just delete others since VS requires 4.6
Regards,
Alex
From: Jeffrey Stedfast
Sent: Thursday, February 07, 2019 12:23 AM
To: jstedfast/MailKit
Cc: Alexboxat ; Author
Subject: Re: [jstedfast/MailKit] Mailkit 2.1.2 + .Net 4.5.2 Error on SmtpClient.Connect (#814)
This is the only place MailKit calls MapToIPv4(): https://github.com/jstedfast/MailKit/blob/master/MailKit/Net/Smtp/SmtpClient.cs#L437
However, this is not in the Connect() method so I'm not sure that's the issue.
Could you debug this and check if that is the right place?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I’ve installed VS 2015 on Windows 7 SP1.
When I try to compile MailIt 2.1.2:
…------ Build started: Project: MailKit.Net45, Configuration: Debug Any CPU ------
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapEventGroup.cs(296,37,296,43): error CS1026: ) expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapEventGroup.cs(296,43,296,44): error CS1002: ; expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapEventGroup.cs(296,43,296,44): error CS1513: } expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapEventGroup.cs(394,12,394,29): error CS1520: Method must have a return type
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapEventGroup.cs(675,1,675,2): error CS1022: Type or namespace definition, or end-of-file expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapUtils.cs(85,35,85,41): error CS1026: ) expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapUtils.cs(85,41,85,42): error CS1002: ; expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapUtils.cs(85,41,85,42): error CS1513: } expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Net\Imap\ImapUtils.cs(526,75,526,84): error CS1003: Syntax error, ',' expected
C:\Users\Lucky\Desktop\MailKit-2.1.2\MailKit\Envelope.cs(453,57,453,61): error CS1003: Syntax error, ',' expected
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
From: Jeffrey Stedfast
Sent: Thursday, February 07, 2019 12:23 AM
To: jstedfast/MailKit
Cc: Alexboxat ; Author
Subject: Re: [jstedfast/MailKit] Mailkit 2.1.2 + .Net 4.5.2 Error on SmtpClient.Connect (#814)
This is the only place MailKit calls MapToIPv4(): https://github.com/jstedfast/MailKit/blob/master/MailKit/Net/Smtp/SmtpClient.cs#L437
However, this is not in the Connect() method so I'm not sure that's the issue.
Could you debug this and check if that is the right place?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Looks like some versions of .NET have a bug: https://stackoverflow.com/questions/23608829/why-does-ipaddress-maptoipv4-throw-argumentoutofrangeexception Check out the accepted answer to that StackOverflow question. What environment are you running .NET 4.5.2? Is it running on Windows? Mac? Linux? Is it using Mono or CoreCLR? I wonder if it has all of the service packs installed? |
1. Windows 7 32 bit with Service Pack 1.
2. It has Service Pack 1 + All Important Updates Installed till now (except Optional).
From: Jeffrey Stedfast
Sent: Thursday, February 07, 2019 3:05 PM
To: jstedfast/MailKit
Cc: Alexboxat ; Author
Subject: Re: [jstedfast/MailKit] Mailkit 2.1.2 + .Net 4.5.2 Error on SmtpClient.Connect (#814)
Looks like some versions of .NET have a bug: https://stackoverflow.com/questions/23608829/why-does-ipaddress-maptoipv4-throw-argumentoutofrangeexception
Check out the accepted answer to that StackOverflow question.
What environment are you running .NET 4.5.2? Is it running on Windows? Mac? Linux? Is it using Mono or CoreCLR?
I wonder if it has all of the service packs installed?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Can you try building the latest revision to see if that fixes things for you? I don't want to make a release only to find out it doesn't fix the issue. Thanks. |
Yes. It works now.
Thank you very much.
From: Jeffrey Stedfast
Sent: Saturday, February 09, 2019 4:20 PM
To: jstedfast/MailKit
Cc: Alexboxat ; Author
Subject: Re: [jstedfast/MailKit] Mailkit 2.1.2 + .Net 4.5.2 Error on SmtpClient.Connect (#814)
Can you try building the latest revision to see if that fixes things for you?
I don't want to make a release only to find out it doesn't fix the issue.
Thanks.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@jstedfast I was getting the above problem and your change resolved it ... however I am now getting another error but that may be unrelated :) |
What problem are you getting now? |
It was a "relay access denied" error but I think it was the wrong relay server for that specific part of the network so it is resolved now as well :) |
ok |
Just an update... I was able to get connected using the following code: await client.ConnectAsync("imap.gmail.com", 993, SecureSocketOptions.SslOnConnect, cancellationToken);
var oauth2 = new SaslMechanismOAuth2(username, apiKey);
await client.AuthenticateAsync(oauth2, cancellationToken); |
Hello, I was getting an exception in our production environment as "Method not found: '!!0[] System.Array.Empty()'." at the time of connecting, Could you please help me to resolve the issue or did I miss anything. Thanks in advance. |
@KrishnaramaGit you somehow managed to leave out all of the important details of the issue you are hitting :-\
My guess is that you are compiling your program on a system with a newer version of .NET than your production machine has, and so even though your development machine has Array.Empty, your production machine does not. |
Desktop:
To Reproduce
client.Connect("smtp.gmail.com", 587, SecureSocketOptions.Auto);
I get Exception:
Specified argument was out of the range of valid values.
Parameter name: newAddress
at
SmtpClient.Connect at System.Net.IPAddress..ctor(Int64 newAddress)
at System.Net.IPAddress.MapToIPv4()
at MailKit.Net.Smtp.SmtpClient.d__61.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MailKit.Net.Smtp.SmtpClient.d__62.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at MailKit.Net.Smtp.SmtpClient.d__70.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
The text was updated successfully, but these errors were encountered: