0 votes

Having a little issue trying to figure out how to insert information into an HTML template. We have an HTML template that is inserted into a disabled users email auto reply. It has been requested that we insert the disabled users name and manager contact info into the template. I have not figured out how i can insert this info into the HTML template from adaxes. Is there anyone that has done this before?

$exchangeServer = "exchange"
$session = New-PSSession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session
$AutoReplyMessage = [io.file]::ReadAllText("C:\Auto_Reply.htm")
Set-MailboxAutoReplyConfiguration -Identity %username%@domain.com -AutoReplyState Scheduled –EndTime “1/1/2050” -ExternalMessage "$AutoReplyMessage"
Remove-PSSession -Session $session
by (70 points)

1 Answer

0 votes
by (400 points)
selected by
Best answer

Hi ABrown. You could search and replace in the email template. From your code example I have added some replace commands. Basically in the html template you would have %username% and that would get replaced with the username from the Adaxes property %username%.

$exchangeServer = "exchange"
$session = New-PSSession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session
$AutoReplyMessage = [io.file]::ReadAllText("C:\Auto_Reply.htm")

# Replace strings in the autoreply text, double % required so Adaxes does not convert
$AutoReplyMessage = $AutoReplyMessage.Replace("%%username%%","%username%")
$AutoReplyMessage = $AutoReplyMessage.Replace("%%adm-ManagerFullName%%","%adm-ManagerFullName%")
$AutoReplyMessage = $AutoReplyMessage.Replace("%%adm-ManagerEmail%%","%adm-ManagerEmail%")

Set-MailboxAutoReplyConfiguration -Identity %username%@domain.com -AutoReplyState Scheduled –EndTime “1/1/2050” -ExternalMessage "$AutoReplyMessage"
Remove-PSSession -Session $session

Alternatively you could put the email template inside the script and let Adaxes replace the properties:

$AutoReplyMessage = @"
<html>
...
Sorry %username% has left.
...
</html>
"@
0

This worked like a charm!!!

Thank you!

0

Hello,

Thank you Nodeblue!

In Adaxes 2013.1 that is scheduled for the end of the month, it will be possible to use Modify Exchange Properties action to set automatic replies:

0

SWEET...Is there a list of new features for 2013?

0

We are currently working on the What's New document ;)

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 everyone, I've received a task to send a report of pending and denied approval requests of a specific task to an email of one of our managers. Since ... $report = $reportHeader + $reportFooter # Send Mail $Context.SendMail($to, $subject, $NULL, $report)

asked Apr 7, 2020 by rshergh (110 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)
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

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 ... Adaxes://$userDN", $NULL, $NULL, 0) $mailbox.SetMailParameters($userParams,"ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")

asked Dec 10, 2013 by RTiel (780 points)
3,348 questions
3,049 answers
7,791 comments
545,058 users