Для отправки "приветственного" сообщения всем новым пользователям организации можно использовать следующий скрипт автоматически запускаемый планировщиком:
$NewUsers = Get-Mailbox -ResultSize Unlimited | Where {($_.WhenCreated -gt (get-date).addhours(-24))}
$Body=get-content "[путь к HTML шаблону письма]" | Out-String
foreach ($NewUser in $NewUsers)
{
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mailserver.domain.com"
$mailmessage.from = ("administrator@domain.com")
$Recipient = $newuser.WindowsEmailAddress.toString()
$mailmessage.To.Add($Recipient)
$mailmessage.Subject = “Welcome”
$mailmessage.IsBodyHTML = $True
$mailmessage.Body = $Body
$smtpclient.Send($mailmessage)
}
http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/7d9efed5-11a8-4eb9-a9e8-329cab57ef2d
$NewUsers = Get-Mailbox -ResultSize Unlimited | Where {($_.WhenCreated -gt (get-date).addhours(-24))}
$Body=get-content "[путь к HTML шаблону письма]" | Out-String
foreach ($NewUser in $NewUsers)
{
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "mailserver.domain.com"
$mailmessage.from = ("administrator@domain.com")
$Recipient = $newuser.WindowsEmailAddress.toString()
$mailmessage.To.Add($Recipient)
$mailmessage.Subject = “Welcome”
$mailmessage.IsBodyHTML = $True
$mailmessage.Body = $Body
$smtpclient.Send($mailmessage)
}
http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/7d9efed5-11a8-4eb9-a9e8-329cab57ef2d
Комментариев нет:
Отправить комментарий