Marcel Grüger
Marcel Grüger

Reputation: 946

Can I check in MailKit if the smtp server requires authentication?

I am using the MailKit (4.0.30319) and I am wondering if I can check if the smtp server requires authentication? So I could check it BEFORE I send an email to someone.

Background is that I don't want the service to give me an exception on sending, but on a testing service button. By this button I create a mailclient and if the user gives me name and password, I try to authenticate. Afterwards I dispose the client.

Now what if he doesn't but the server wants to? I tried to use AuthenticationMechanisms. But here I only get a List of possible options. Could I here check on a missing entry like "FREELOGIN" or something similar?

Upvotes: 0

Views: 436

Answers (1)

jstedfast
jstedfast

Reputation: 38618

The latest version of MailKit is 2.10.1, so I'm not sure where 4.0.30319 is coming from...

That said, to answer your question - if an SMTP server provides authentication mechanisms, it usually (always?) means that the server requires authentication.

There is no way to know for certain, though, until you actually attempt to send a message and get an error.

Upvotes: 1

Related Questions