Skip to content

IAdmServiceMailSettings

The IAdmServiceMailSettings interface is used to manage outgoing mail settings of Adaxes service.

Inheritance: The IAdmServiceMailSettings interface inherits from the IUnknown interface.

Note

To get the IAdmServiceMailSettings interface:

How

Methods

Properties

  • Property

  • Description

  • Host

  • Gets or sets the fully qualified domain name (FQDN) of an SMTP server that will be used to send outgoing emails.

  • Port

  • Gets or sets the port of the SMTP server used to send outgoing emails.

  • EnableSsl

  • Gets or sets a value indicating whether to enable encrypted connection (SSL) with the SMTP server used to send outgoing emails.

  • DefaultCredentials

  • Gets or sets a value indicating whether Adaxes will send outgoing emails using the specified credentials.

  • UserName

  • Gets or sets the username that will be used to send outgoing emails.

  • Password

  • Gets or sets the password to use with the username specified in the UserName property.

  • From

  • Gets or sets the email address from which outgoing emails will be sent.

Details

Save()

Saves the outgoing mail settings.

void Save()

Examples

The following code sample changes the email address from which outgoing emails will be sent.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Service Settings' container
$wellknownContainerPath = $admService.Backend.GetConfigurationContainerPath("ServiceSettings")
$serviceSettings = $admService.OpenObject($wellknownContainerPath, $null, $null, 0)
$mailSettings = $serviceSettings.MailSettings

# Update mail settings
$mailSettings.From = "user@company.com"
$mailSettings.Save()
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.Management;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Service Settings' container
        String wellknownContainerPath = admService.Backend.GetConfigurationContainerPath(
            "ServiceSettings");
        IAdmServiceSettings serviceSettings = (IAdmServiceSettings) admService.OpenObject(
            wellknownContainerPath, null, null, 0);
        IAdmServiceMailSettings mailSettings = serviceSettings.MailSettings;

        // Update mail settings
        mailSettings.From = "user@company.com";
        mailSettings.Save();
    }
}

SendMail()

Sends an email to the specified recipient.

void SendMail(String to, 
              String subject, 
              String textBody, 
              String htmlBody,
              String from, 
              String cc, 
              String bcc)

Parameters

  • to - Specifies the recipient’s email address.
  • subject - Specifies the subject of the email.
  • textBody - Specifies the body of the email. This parameter can be set to NULL.
  • htmlBody - Specifies the body of the email in the HTML format. This parameter can be set to NULL.
  • from - Specifies the address from which the email will be sent. If the parameter is set to NULL, the email address specified in the From property will be used.
  • cc - Specifies a list of comma separated email addresses to which a carbon copy (CC) of the email message will be sent. This parameter can be set to NULL.
  • bcc - Specifies a list of comma separated email addresses that receive a copy of the mail but are not listed as recipients of the message. This parameter can be set to NULL.

Examples

The following code sample changes the email address from which outgoing emails will be sent.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Service Settings' container
$wellknownContainerPath = $admService.Backend.GetConfigurationContainerPath("ServiceSettings")
$serviceSettings = $admService.OpenObject($wellknownContainerPath, $null, $null, 0)
$mailSettings = $serviceSettings.MailSettings

# Email settings
$to = "jdoe@company.com, jsmith@company.com"
$subject = "My Subject"
$textBody = "My Message"
$from = "fromaddress@company.com"
$cc = "ccaddress@company.com"
$bcc = "bccaddress@company.com"

# Send mail
$mailSettings.SendMail($to, $subject, $textBody, $Null, $from, $cc, $bcc)
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.Management;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Service Settings' container
        String wellknownContainerPath = admService.Backend.GetConfigurationContainerPath(
            "ServiceSettings");
        IAdmServiceSettings serviceSettings = (IAdmServiceSettings) admService.OpenObject(
            wellknownContainerPath, null, null, 0);
        IAdmServiceMailSettings mailSettings = serviceSettings.MailSettings;

        // Email settings
        string to = "jdoe@company.com, jsmith@company.com";
        string subject = "My Subject";
        string textBody = "My Message";
        string from = "fromaddress@company.com";
        string cc = "ccaddress@company.com";
        string bcc = "bccaddress@company.com";

        // Send mail
        mailSettings.SendMail(to, subject, textBody, null, from, cc, bcc);
    }
}

TestSettings()

Sends a test message to the given email address.

void TestSettings(String recipientEmail)

Parameters

The recipientEmail parameter specifies the email address to which a test message will be sent.


Host

Gets or sets the fully qualified domain name (FQDN) of an SMTP server that will be used to send outgoing emails.

  • Type:
  • String
  • Access:
  • Read/Write

Port

Gets or sets the port of the SMTP server used to send outgoing emails.

  • Type:
  • Int32
  • Access:
  • Read/Write

EnableSsl

Gets or sets a value indicating whether to enable encrypted connection (SSL) with the SMTP server used to send outgoing emails.

  • Type:
  • Boolean
  • Access:
  • Read/Write

DefaultCredentials

Gets or sets a value indicating whether Adaxes will send outgoing emails using the specified credentials.

  • Type:
  • Boolean
  • Access:
  • Read/Write

UserName

Gets or sets the username that will be used to send outgoing emails. Setting this property takes effect only if the DefaultCredentials property is set to TRUE.

  • Type:
  • String
  • Access:
  • Read/Write

Password

Gets or sets the password to use with the username specified in the UserName property. Setting this property takes effect only if the DefaultCredentials property is set to TRUE.

  • Type:
  • String
  • Access:
  • Read/Write

From

Gets or sets the email address from which outgoing emails will be sent.

  • Type:
  • String
  • Access:
  • Read/Write

Requirements

Minimum required version: 2009.1

See also