IAdmSmtpBasicAuth
The IAdmSmtpBasicAuth interface represents the username and password credentials in outgoing mail settings of Adaxes service.
Inheritance: IAdmSmtpAuth
Properties
-
Method
-
Description
-
UserName()
-
Gets or sets the username that will be used to authenticate against the SMTP server.
-
Password()
-
Gets or sets the password that will be used to authenticate against the SMTP server.
Details
UserName
Gets or sets the username that will be used to authenticate against the SMTP server.
- Type:
- string
- Access:
- Read/Write
Password
Gets or sets the password that will be used to authenticate against the SMTP server.
- Type:
- string
- Access:
- Read/Write
Examples
The following code sample updates the account that the Adaxes service will use to send emails.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service. $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the Service Settings container. $wellknownContainerPath = $service.Backend.GetConfigurationContainerPath("ServiceSettings") $serviceSettings = $service.OpenObject($wellknownContainerPath, $null, $null, 0) # Create the credentials object. $credentials = New-Object "Softerra.Adaxes.Management.AdmSmtpBasicAuth" $credentials.UserName = "admin@example.com" $credentials.Password = "Password" # Update credentials. $serviceSettings.MailSettings.SmtpAuth = $credentials $serviceSettings.MailSettings.Save()
- C#
-
using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi.Management; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; using Softerra.Adaxes.Management; class Program { private static void Main(string[] args) { // Connect to the Adaxes service. AdmNamespace ns = new AdmNamespace(); IAdmService service = ns.GetServiceDirectly("localhost); // Bind to the Service Settings container. string wellknownContainerPath = service.Backend.GetConfigurationContainerPath( "ServiceSettings"); IAdmServiceSettings serviceSettings = (IAdmServiceSettings)service.OpenObject( wellknownContainerPath, null, null, 0); // Create the credentials object. IAdmSmtpBasicAuth credentials = new AdmSmtpBasicAuth(); credentials.UserName = "admin@example.com"; credentials.Password = "Password"; // Update credentials. serviceSettings.MailSettings.SmtpAuth = credentials; serviceSettings.MailSettings.Save(); } }
Requirements
Minimum required version: 2025.1