I am using a CreateUserWizard, which if a MailDefinition is created on it, will look for the default SMTPClient as defined in the configuration section.
I would like to use this configuration section, however the password I want to use is encrypted.
I am attempting to derive from SMTPClient(recommended by another generous poster in previous question) my attempt at implementing is below:
public class MySmtpClient: SmtpClient
{
public MySmtpClient() : base()
{
MySmtpClient mySmtpClient = new MySmtpClient();
NetworkCredential nc = CredentialCache.DefaultNetworkCredentials;
nc.Password = DecryptMyPassword(nc.Password);
mySmtpClient.Credentials = nc;
I still haven’t gotten that part working – but when I do – how do I make it so that the CreateUserWizard uses my derived object to send mail versus the default SMTPClient object?
Thank you!
Handle
OnSendingMailevent of CreateUserWizard.In the event handler, use
MySmtpClientand cancel the default client by settinge.Cancel = true;Hope this helps!