<p>I have an App that will send authenticated emails using System.Net.Mail and System.Net.NetworkCredential my question is how should I store the password that is needed to create a NetworkCrednetial object?</p>

<p>The application doesn't have a login but I could setup an option that allows the user to enter their email credentials (in almost all cases this will be their windows login). I can't use Active Directory because not every customer uses it. </p>

<p>I could get the password from the user and then persist it to the users registry, a file or a database. Obviously i'd have to encrypt it. I'm not very familiar with encryption so some pointers would be appreciated if people think thats the best mechanism.</p>

<p>My preference would be to avoid having to store anything, so is there anyway I can get around having to store the credentials myself, perhaps I can get it from the current login or somewhere else?</p>

To store a username and password (in Windows) use the
DPAPI
. The .Net interface to it is the
ProtectedData
and ProtectedMemory classes.
But first, you could try if the
UseDefaultCredentials
or DefaultNetworkCredentials is working for your environment.