0 votes

I'm using the following code to add an email address to a mailbox (which works). But how can I mark the address as reply address?:

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

$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("[Server]")

# Bind to user object
$userDN = "[DN]"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Create an instance of the AdmExchangeMailContactParameters class
#set EmailAddressPolicyEnabled to False before making changes
$userParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"
$userParams.EmailAddressPolicyEnabled = $False
#$user.SetMailParameters($userParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

# Add a new modification
$emailAddresses = $userParams.EmailAddresses
$emailAddresses.OverrideOldValues = $False
$newAddress = $emailAddresses.CreateAddress("ADM_EXCHANGE_ADDRTYPE_SMTP", $null)
$newAddress.Address = "[account]"
$emailAddresses.Add("ADS_PROPERTY_APPEND", $newAddress)
$userParams.EmailAddresses = $emailAddresses
$mailbox = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)
$mailbox.SetMailParameters($userParams,"ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")

by (780 points)

1 Answer

0 votes
by (780 points)

fixed it by using: $newAddress.IsPrimary = $true

Related questions

0 votes
1 answer

Since 2020.1 added the friendly From name for emails, I would like to ask for the ability to specify a Reply-to address. This would be very helpful to have ... develing deeper into the System.Net.Mail.MailMessage class to add a replyto address to message.

asked Jul 15, 2020 by polley (1.2k points)
0 votes
1 answer

Hello, I think I might have found a regression. Starting 2014.1 it is impossible to change the reply address for a user having an Exchange 2003 mailbox. The button "Set ... related to my authorizations; I did test various configuration (admin, ...). Regards,

asked May 2, 2014 by Pierre (750 points)
0 votes
1 answer

Hi team, I am trying to set a primary smtp address to a user based on input during creation. If someone set a specific email in form, this is stored in customAttributeText3 and ... a specifc email address as primary? Do I need to run a PS command to set it?

asked Oct 13, 2023 by wintec01 (1.5k points)
0 votes
1 answer

When creating a hybrid user mailbox with a Business Rule, after user creation, the remote routing address of the mailbox is set to the users email alias. How do I set it to the 365 address username@ourdomain.mail.onmicrosoft.com

asked Apr 13, 2022 by john.harding (70 points)
+1 vote
1 answer

I'm trying to enable SSO using SAML with AzureAD as the IDP. I'm struggling to get it to work, we use a BIG-IP as our loadbalancer which handles the SSL offloading. ... offloading or am I forced to remove the SSL offloading and do it on the server itself?

asked May 12, 2020 by Quinten (100 points)
3,567 questions
3,258 answers
8,268 comments
547,929 users