Mail Flow

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

  • Maximum receiving message size
  • Maximum sending message size

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
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the group
$groupDN = "CN=My Group,CN=Groups,DC=domain,DC=com"
$group = $service.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