Aspose logging Email

Hey I have followed your example here SmtpClient Activity Logging|Documentation and made logging work.

I would like to adjust the log level so I can see more or less information when required, is this possible via adding additional XML elements and if so what please?
Also is it possible to set this information via code instead, using c#, so that I can make the file address dynamic based on the current user?

Sorry I have not been able to find information about this directly so appreciate any help.

Cheers

Hello @chamelsoft,

Thank you for writing to Aspose support forum.

Could you, please, clarify what kind of information you expect to see at different levels? How many levels are supposed to be there? Log-file entries are messages from a client and a server.

You can also enable logging immediately in the code.
Note: even if you have already enabled logging by using configuration files, this option will be applied.

The following are the steps to enable logging in SmtpClient in C#:

using (var client = new SmtpClient("your smtp server"))
{
    // Set username, password, port, and security options
    client.Username = "your username";
    client.Password = "your password";
    client.Port = 465;
    client.SecurityOptions = SecurityOptions.SSLImplicit;

    // Set the path to the log file using the LogFileName property.
    client.LogFileName = @"C:\Aspose.Email.Smtp.log";
    
    // Set the UseDateInLogFileName property if it is necessary.
    client.UseDateInLogFileName = false;

    var eml = new MailMessage("from address", "to address", "this is a test subject", "this is a test body");

    client.Send(eml);
}

Wonderful thank you for the assistance

@chamelsoft,

Thank you for using Aspose products.