Skip to content

Mail Flow

The following code sample modifies message size restrictions for a mail-enabled group.

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

# Create an instance of the AdmExchangeMailGroupParameters class
$groupParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailGroupParameters"

$messageSizeRestrictions = $groupParams.MailFlowSettings.MessageSizeRestrictions
$messageSizeRestrictions.IsModificationEnabled = $True

# Set maximum receiving message size to 25 MB
$maxReceiveSize = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmByteQuantifiedSize"
$maxReceiveSize.SetMBytes(25)

$messageSizeRestrictions.MaxReceiveSize = $maxReceiveSize

# Set maximum sending message size to 25 MB
$maxSendSize = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmByteQuantifiedSize"
$maxSendSize.SetMBytes(25)

$messageSizeRestrictions.MaxSendSize = $maxSendSize

# Save changes
$group.SetMailParameters($groupParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

See also