SmtpClient credentials RRS feed

  • Dotaz

  • C# - VS 2010

    I am making an application which is using SmtpClient class for sending an emails.

    There is a button "Send" in my application which will send an email through the SmtpClient class.

    I am logged in Windows via Active Directory and I need to forward credentials to SmtpClient.

    So, the application will work like this. User will log to windows via AD credentials and if he press the button Send in my application, he will NOT be noticed to enter login/password again. Until the AD policy will change the password the user will not be prompted to do anything. I am able to obtain user's information from AD [email, ...] which I use for SmtpClient, but I didn't figure out how to make it working.

    Could you help me please?

    čtvrtek 28. ledna 2016 9:58


  • Hi,

    it deppends on allowed security settings of your SMTP server.


    SmtpClient client = new SmtpClient(server);
    client.Credentials = CredentialCache.DefaultNetworkCredentials;


    Robert Haken, Microsoft MVP ASP.NET/IIS, HAVIT, s.r.o.,,

    pátek 12. února 2016 14:30