none
SmtpClient credentials

    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?

    28. ledna 2016 9:58

Odpovědi

  • Hi,

    it deppends on allowed security settings of your SMTP server.

    Try

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

    Regards,


    Robert Haken, Microsoft MVP ASP.NET/IIS, HAVIT, s.r.o., www.havit.cz, http://knowledge-base.havit.cz

    12. února 2016 14:30
    Moderátor