Skip to content

Mail Flow

This code sample retrieves the following parameters of a mail-enabled group:

  • Maximum receiving message size
  • Maximum sending message size

Note

In the below code sample, the $groupParams variable represents Exchange properties of a mail-enabled group. To retrieve the properties, use the IAdmExchangeMailParametersOps::GetMailParameters method.

How
[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 group
$groupDN = "CN=My Group,CN=Users,DC=domain,DC=com"
$group = $admService.OpenObject("Adaxes://$groupDN", $NULL, $NULL, 0)

# Get Exchange properties
$groupParams = $group.GetMailParameters()
# The $groupParams variable represents Exchange properties of a mail-enabled group

# Get message size restrictions
$messageSizeRestrictions = $groupParams.MailFlowSettings.MessageSizeRestrictions

# Maximum receiving message size
$maxReceiveSize = $messageSizeRestrictions.MaxReceiveSize
if ($maxReceiveSize -ne $NULL)
{
    Write-Host "Maximum receiving message size:" $maxReceiveSize.GetKBytes()
}

# Maximum sending message size
$maxSendSize = $messageSizeRestrictions.MaxSendSize
if ($maxSendSize -ne $NULL)
{
    Write-Host "Maximum sending message size:" $maxSendSize.GetKBytes()
}

See also