-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
The hostname could not be parsed #1040
Comments
The exception is being thrown in Does it have international characters in it? What about the username they they are using? (the Uri string passed to the Uri .ctor is of the form It might be a bug in the Uri parser or it might be that MailKit needs to IDN-encode the hostname or perhaps it isn't hex-encoding the username correctly. There's just way too many unknowns for me to have any idea what is wrong without more information. |
Actually, looking at the stacktrace again, it looks like it's actually in the COmputeDefaultValues() method which does not take into consideration the username. https://github.com/jstedfast/MailKit/blob/master/MailKit/Net/Imap/ImapClient.cs#L1175 BUT based on that code, it might be the port being serialized to a string (although I'm not sure about that because I would imagine that the error message in the Uri parser exception would have told us it was in the port or something other than claiming it was the hostname it couldn't parse). |
Hi, The port we fill is of type "int" and is a requirement. It is always filled. Hope this info helps :) |
Right, but what is the port value? If their locale formats integers with commas, that could cause |
The value is 25 for their port. Regarding locale, are you referring to the regional settings from the windows server for this? Or something else? |
The .NET CultureInfo being used by the program. I don't think port 25 would get written as anything other than "25" in any culture, would it? I have no idea, but the only cases I know of where it might be vary is when the integer value is >= 1000 (i.e. "1,000" or "1.000" vs "1000") |
yeah i would also think 25 would just be 25 :) |
It's possible, but I have no idea if it actually fixes the issue. I can't replicate the exception with the information you've given me. |
hmmm Okay, |
You could write a test program for them that prints out what the port looks like when formatted as a string. If you wanted to get fancy, you could print out all of the
The most important info is:
and
|
Once i get back monday i'll whip up a test console app and get our support department to make contact with the customer to try it. edit 22-06-2020 edit 29-06-2020 |
@jstedfast some happy news here. It seems that microsofts old smtp implementation was okay with this since the settings where never changed according to the servermanager. I have made a bugreport for our frontend developers(internal) to add extra validation for this for the next patch or our wpf client. Thnx for all the help! |
No problem and glad you figured out the issue! |
Hi,
In a production environment from one of our customers we recieve a message that MailKit produces a "UriFormatException: The hostname could not be parsed error".
They use a internal mailserver with the following SMTP server name: "servername.network.local" and are connecting to it through port 25.
We hoped that this would work but it seems that somehow MailKit does not support it.
In a previous release or our webservice where we were still using the SMTP client from the .NET Framework 4.6.1 it was working without issues.
The only thing between our product releases that was changed is that we replaced the default .NET Framework SMTP client with the MailKit implemententation.
Unfortunatly we don't have a internal mailserver our self(we use office365) and were are not able to reproduce the issue.
The webservice is build upon .NET Framework 4.6.1 and uses MailKit 2.2.0.
Upgrading MailKit to 2.7.0 wont be easy as the customer has a strict update policy which prevents us from delivering updates on the fly or only lets us deliver a update if we are certain that the update will fix the issue(by supplying changelogs and such).
Is this a known issue?
Or was this a known issue that has been patched?
Screenshot of the error as sent to us by the customer:
Unfortunatly we are not able to provide a log as this feature is not implemented(but we certenly will do in a future release).
We use the code below to create a connection:
Kind regards,
Walter Ebbers
The text was updated successfully, but these errors were encountered: