none
新开通账户自动推送信息 RRS feed

  • 问题

  • exchange2010sp3 如何配置在新邮箱开通的同时,系统自动发送一封自定义好的邮件,包含公司内部的新员工须知,用户操作手册及相应的链接等内容
    2017年10月6日 3:20

全部回复

  • 您好,

    感谢联系我们社区。

    建议使用下面步骤进行设置:

    1.导航至 <installation path>\Bin\CmdletExtensionAgents\ 找到文件 ScriptingAgentConfig.xml.sample

     

    2.重命名文件为ScriptingAgentConfig.xml 并替换掉XML内容如下:

     

    <Feature Name="Welcome Email" Cmdlets="New-Mailbox,Enable-Mailbox">

      <ApiCall Name="OnComplete">

       if($succeeded)    {

                    if ($provisioningHandler.TaskName -eq "New-Mailbox") {

    # Replace place holder.

                    $USRdname=$provisioningHandler.UserSpecifiedParameters["Name"]

                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))

                    $tempmsg = $tempmsg -replace "NewUser00",$USRdname

     

                    # Picking Primary SMTP address,saving to $pSMTP to send email.

                    $Ualias=$provisioningHandler.UserSpecifiedParameters["Alias"]

                    $pSMTP = (get-mailbox $Ualias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()

    }              

    elseif ($provisioningHandler.TaskName -eq "Enable-Mailbox") {               

    # Picking Primary SMTP address,saving to $pSMTP to send email.

                    $eUalias=$provisioningHandler.UserSpecifiedParameters["Alias"]

                    $dName = (get-mailbox $eUalias | select-object Name | Format-Wide | Out-String ).trim()        

                    $pSMTP = (get-mailbox $eUalias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()

     

                    # Replace place holder.

                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))

                    $tempmsg = $tempmsg -replace "NewUser00",$dName

    }

                    # Please give the correct HUB serve IP address in the following line.

                    $HUBServer="20.1.1.2"

                    $EMail =new-object net.mail.mailmessage

                    $HUBTask = new-object net.mail.smtpclient($HUBServer)

                    # Email with attachment will be sent from the address given in the following line.

                    $EMail.From="administrator@exchange2010.com"

                    # Email with attachment will be sent TO the address given in the following line.

                    $EMail.To.add($pSMTP)

                    # Email Subject and Body details are specified in following lines

                    $EMail.Subject="Welcome to Contoso IT !!!"

                    $EMail.Body= $tempmsg

                    $Email.IsBodyHtml = $true

                    $HUBTask.send($EMail)

       }

      </ApiCall>

    </Feature>

    黄色部分根据您的环境进行替换。

     

    3. 复制这个更改好的ScriptingAgentConfig.xml文件到您环境中每一台服务器,并运行命令:Enable-CmdletExtensionAgent "Scripting Agent" 去启用代理。

    建议参考: https://blogs.technet.microsoft.com/sukum/2014/07/10/send-welcome-email-to-new-mailbox-new-users/ 此文章为英文版,暂无中文版,建议翻译查看。

    希望可以帮到您。


    Regards,

    Jason Chao


    如果以上回复对您有所帮助,建议您将其标记为答复

    如果您对我们的论坛支持有任何的建议,可以通过此邮箱联系我们: tnmff@microsoft.com.

    • 已编辑 Jason.Chao 2017年10月9日 4:48
    • 已建议为答案 Jason.Chao 2017年10月10日 5:34
    • 取消建议作为答案 gerry2010 2017年10月19日 1:03
    2017年10月9日 4:48
  • 参照建议 https://blogs.technet.microsoft.com/sukum/2014/07/10/send-welcome-email-to-new-mailbox-new-users/插入在<Configuration version="1.0">后另起一行后复制粘贴,并根据实际情况修改保存后,打开emc提示如下图。

    把<Configuration version="1.0">一行删除后保存,可以打开emc,但是创建新的邮箱账户后并没有收到新用户通知。hubserver有2台,所以两台hubserver分别填写了对应的ip,还有Email.From的邮箱地址只是一个虚拟的邮箱地址么,代理通过哪个邮箱地址去发送邮件的
    2017年10月17日 7:57
  • 您好,感谢您的回复:

    整体格式应该如下:

    <?xml version="1.0" encoding="utf-8" ?> 

       <Configuration version="1.0"> 

       <Feature Name= "Welcome Email" Cmdlets="New-Mailbox, Enable-Mailbox"

       <ApiCall Name="OnComplete">

    ...

       </Feature> 

       </Configuration>

    另外请问是否在每个HUB服务器上都更改并进行了保存,还有必须运行下面命令:

    Enable-CmdletExtensionAgent "Scripting Agent"

    另外还可以参考下载下面文章的ZIP文件,里面有另外的脚本。

    https://blogs.msdn.microsoft.com/emeamsgdev/2014/07/23/exchange-automating-a-welcome-email-to-new-users/

    还有另外一种方法:

    https://gallery.technet.microsoft.com/office/Send-Welcome-Mail-to-Each-4fff4a93

    希望可以帮到您。


    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2017年10月19日 2:48
  • htm格式修改并在每个hub上都保存了,Enable-CmdletExtensionAgent "Scripting Agent"这个前面已经执行过了,但是新用户仍然没有收到新开通的通知,具体如下,请帮我看下哪里还会有问题:

    hub服务器1:

    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="Welcome Email" Cmdlets="New-Mailbox,Enable-Mailbox">

      <ApiCall Name="OnComplete">

       if($succeeded)    {

                    if ($provisioningHandler.TaskName -eq "New-Mailbox") {

    # Replace place holder.

                    $USRdname=$provisioningHandler.UserSpecifiedParameters["Name"]

                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))

                    $tempmsg = $tempmsg -replace "NewUser00",$USRdname

     

                    # Picking Primary SMTP address,saving to $pSMTP to send email.

                    $Ualias=$provisioningHandler.UserSpecifiedParameters["Alias"]

                    $pSMTP = (get-mailbox $Ualias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()

    }              

    elseif ($provisioningHandler.TaskName -eq "Enable-Mailbox") {               

    # Picking Primary SMTP address,saving to $pSMTP to send email.

                    $eUalias=$provisioningHandler.UserSpecifiedParameters["Alias"]

                    $dName = (get-mailbox $eUalias | select-object Name | Format-Wide | Out-String ).trim()        

                    $pSMTP = (get-mailbox $eUalias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()

     

                    # Replace place holder.

                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))

                    $tempmsg = $tempmsg -replace "NewUser00",$dName

    }

                    # Please give the correct HUB serve IP address in the following line.

                    $HUBServer="192.168.xxx.yyy"

                    $EMail =new-object net.mail.mailmessage

                    $HUBTask = new-object net.mail.smtpclient($HUBServer)

                    # Email with attachment will be sent from the address given in the following line.

                    $EMail.From="administrator@aabb"

                    # Email with attachment will be sent TO the address given in the following line.

                    $EMail.To.add($pSMTP)

                    # Email Subject and Body details are specified in following lines

                    $EMail.Subject="Welcome to aabb !!!"

                    $EMail.Body= $tempmsg

                    $Email.IsBodyHtml = $true

                    $HUBTask.send($EMail)

       }

      </ApiCall>

    </Feature>
    </Configuration>

    hub服务器2:
    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="Welcome Email" Cmdlets="New-Mailbox,Enable-Mailbox">

      <ApiCall Name="OnComplete">

       if($succeeded)    {

                    if ($provisioningHandler.TaskName -eq "New-Mailbox") {

    # Replace place holder.

                    $USRdname=$provisioningHandler.UserSpecifiedParameters["Name"]

                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))

                    $tempmsg = $tempmsg -replace "NewUser00",$USRdname

     

                    # Picking Primary SMTP address,saving to $pSMTP to send email.

                    $Ualias=$provisioningHandler.UserSpecifiedParameters["Alias"]

                    $pSMTP = (get-mailbox $Ualias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()

    }              

    elseif ($provisioningHandler.TaskName -eq "Enable-Mailbox") {               

    # Picking Primary SMTP address,saving to $pSMTP to send email.

                    $eUalias=$provisioningHandler.UserSpecifiedParameters["Alias"]

                    $dName = (get-mailbox $eUalias | select-object Name | Format-Wide | Out-String ).trim()        

                    $pSMTP = (get-mailbox $eUalias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()

     

                    # Replace place holder.

                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))

                    $tempmsg = $tempmsg -replace "NewUser00",$dName

    }

                    # Please give the correct HUB serve IP address in the following line.

                    $HUBServer="192.168.xxx.zzz"

                    $EMail =new-object net.mail.mailmessage

                    $HUBTask = new-object net.mail.smtpclient($HUBServer)

                    # Email with attachment will be sent from the address given in the following line.

                    $EMail.From="administrator@aabb"

                    # Email with attachment will be sent TO the address given in the following line.

                    $EMail.To.add($pSMTP)

                    # Email Subject and Body details are specified in following lines

                    $EMail.Subject="Welcome to aabb !!!"

                    $EMail.Body= $tempmsg

                    $Email.IsBodyHtml = $true

                    $HUBTask.send($EMail)

       }

      </ApiCall>

    </Feature>
    </Configuration>

    2017年10月20日 0:18
  • 你好根据我的测试:

    可以使用以下脚本:我看了一下,我更改了加粗斜体部分:

    $USRdname=$provisioningHandler.UserSpecifiedParameters["Identity"]

    下面加粗部分字体建议根据您的环境更改,确保没有问题。

    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="Welcome Email" Cmdlets="New-Mailbox,Enable-Mailbox">
    
      <ApiCall Name="OnComplete">
    
       if($succeeded)    {
    
                    if ($provisioningHandler.TaskName -eq "New-Mailbox") {
    
    # Replace place holder.
    
                    $USRdname=$provisioningHandler.UserSpecifiedParameters["Identity"]
    
                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))
    
                    $tempmsg = $tempmsg -replace "NewUser00",$USRdname
    
     
    
                    # Picking Primary SMTP address,saving to $pSMTP to send email.
    
                    $Ualias=$provisioningHandler.UserSpecifiedParameters["Alias"]
    
                    $pSMTP = (get-mailbox $Ualias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()
    
    }              
    
    elseif ($provisioningHandler.TaskName -eq "Enable-Mailbox") {               
    
    # Picking Primary SMTP address,saving to $pSMTP to send email.
    
                    $eUalias=$provisioningHandler.UserSpecifiedParameters["Alias"]
    
                    $dName = (get-mailbox $eUalias | select-object Name | Format-Wide | Out-String ).trim()        
    
                    $pSMTP = (get-mailbox $eUalias | select-object PrimarySMTPAddress | Format-Wide | Out-String ).trim()
    
     
    
                    # Replace place holder.
    
                    $tempmsg= [string] (get-content ("c:\welcome\WelcomeMSG.htm"))
    
                    $tempmsg = $tempmsg -replace "NewUser00",$dName
    
    }
    
                    # Please give the correct HUB serve IP address in the following line.
    
                    $HUBServer="192.168.xxx.yyy"
    
                    $EMail =new-object net.mail.mailmessage
    
                    $HUBTask = new-object net.mail.smtpclient($HUBServer)
    
                    # Email with attachment will be sent from the address given in the following line.
    
                    $EMail.From="administrator@test.com"
    
                    # Email with attachment will be sent TO the address given in the following line.
    
                    $EMail.To.add($pSMTP)
    
                    # Email Subject and Body details are specified in following lines
    
                    $EMail.Subject="Welcome to aabb !!!"
    
                    $EMail.Body= $tempmsg
    
                    $Email.IsBodyHtml = $true
    
                    $HUBTask.send($EMail)
    
       }
    
      </ApiCall>
    
    </Feature>
    </Configuration>

    测试结果如下:

    希望可以帮到您。


    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    2017年10月20日 2:53
  • 在收到您的答复之前,我测试了您提供的另外的方法https://gallery.technet.microsoft.com/office/Send-Welcome-Mail-to-Each-4fff4a93,执行了 remoteexchange.ps1和sendwelcomemessage.ps1,现在新建邮箱账户会出现警告提示如下:

    摘要: 1 个项目。1 个成功,0 个失败。
    已用时间: 00:00:12


    test999
    已完成

    警告:
    具备索引 5 的 cmdlet 扩展代理在 OnComplete() 中引发了异常。异常情况为: Microsoft.Exchange.Provisioning.ProvisioningException: ScriptingAgent: 对 OnComplete API 调用 Scriptlet 时引发了异常: 使用“1”个参数调用“Send”时发生异常:“SMTP 服务器要求安全连接或客户端未通过身份验证。 服务器响应为: 5.7.1 Client was not authenticated”。 ---> System.Management.Automation.MethodInvocationException: 使用“1”个参数调用“Send”时发生异常:“SMTP 服务器要求安全连接或客户端未通过身份验证。 服务器响应为: 5.7.1 Client was not authenticated” ---> System.Net.Mail.SmtpException: SMTP 服务器要求安全连接或客户端未通过身份验证。 服务器响应为: 5.7.1 Client was not authenticated
       在 System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
       在 System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
       在 System.Net.Mail.SmtpClient.Send(MailMessage message)
       在 Send(Object , Object[] )
       在 System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
       --- 内部异常堆栈跟踪的结尾 ---
       在 System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
       在 System.Management.Automation.ParserOps.CallMethod(Token token, Object target, String methodName, Object[] paramArray, Boolean callStatic, Object valueToSet)
       在 System.Management.Automation.MethodCallNode.InvokeMethod(Object target, Object[] arguments, Object value)
       在 System.Management.Automation.MethodCallNode.Execute(Array input, Pipe outputPipe, ExecutionContext context)
       在 System.Management.Automation.ParseTreeNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
       在 System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
       --- 内部异常堆栈跟踪的结尾 ---
       在 Microsoft.Exchange.ProvisioningAgent.ScriptingAgentHandler.OnComplete(Boolean succeeded, Exception e)
       在 Microsoft.Exchange.Provisioning.ProvisioningLayer.OnComplete(Task task, Boolean succeeded, Exception exception)

    已完成的 Exchange 命令行管理程序命令:
    New-Mailbox -Name 'test999' -Alias 'test999' -UserPrincipalName 'test999@test.com' -SamAccountName 'test999' -FirstName '999' -Initials '' -LastName 'test' -Password 'System.Security.SecureString' -ResetPasswordOnNextLogon $false

    已用时间: 00:00:12

    是不是两种方法冲突了?怎么取消


    2017年10月20日 3:23
  • 根据以下报错。应该不是冲突。

    -------------------------------------------

    使用“1”个参数调用“Send”时发生异常:“SMTP 服务器要求安全连接或客户端未通过身份验证。 服务器响应为: 5.7.1 Client was not authenticated”。

    -------------------------------------------

    发送邮件时,显示客户端无法通过验证。

    建议在接受连接器上勾选,Exchange 服务器验证,Exchange server 和 anonymous权限选项。

    希望可以帮到您。



    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2017年10月20日 5:35
  • 我有三个连接器,是要改哪个呢,没有执行这个脚本前都正常。:
    第一个是接收smtp的加密协议的
    第二个是接收internet邮件(用了中继)
    第三个是接收smtp的非加密连接协议的

    


    2017年10月20日 11:23
  • 感谢您的回复,

    是default 接受连接器,确保每台的的接收连接器都有勾选如上面的截图。


    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2017年10月23日 7:22
  • 已经确认每台default接收连接器已经勾选了匿名用户和exchange服务器了但是警告依旧存在。端口需要配置使用哪些,默认是25端口


    • 已编辑 gerry2010 2017年10月23日 10:08
    2017年10月23日 10:04
  • 您好,

    端口就是默认的25 端口。建议参考下面的博客

    Exchange设置自动发送新员工欢迎邮件

    请注意:由于网站不是由Microsoft托管,所以链接可能会更改,恕不另行通知。

    建议重新启动一下transport  service 在每台服务器然后检查结果。

    希望可以帮到您。


    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • 已建议为答案 Jason.Chao 2017年11月1日 9:41
    2017年10月27日 3:17