none
Exchange邮箱用户首次登陆欢迎邮件问题咨询 RRS feed

  • 问题

  • 用如下脚本,可以实现,目前此脚本我在20102013的测试环境中测试过,都没有问题,但是在生产环境中无法实现

    <?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") {

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

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

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

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

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

    }             

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

                   $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()

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

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

    }

                    $HUBServer="10.83.40.35"

                    $EMail =new-object net.mail.mailmessage

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

                    $EMail.From="momohr@immomo.com"

                    $EMail.To.add($pSMTP)

                    $EMail.Subject="欢迎加入xx!"

                    $EMail.Body= $tempmsg

                    $Email.IsBodyHtml = $true

                    $HUBTask.send($EMail)

    }

    </ApiCall>

    </Feature>

    </Configuration>

    在生产环境中进行配置,启用户时,都会有如下警告

    具备索引5 cmdlet 扩展代理在OnComplete() 中引发了异常。异常情况为: Microsoft.Exchange.Provisioning.ProvisioningException: ScriptingAgent: OnComplete API 调用Scriptlet 时引发了异常: 使用“1”个参数调用“Send”时发生异常:“事务失败。 服务器响应为:5.6.0 Invalid message content”。---> System.Management.Automation.MethodInvocationException: 使用“1”个参数调用“Send”时发生异常:“事务失败。 服务器响应为:5.6.0 Invalid message content---> System.Net.Mail.SmtpException: 事务失败。 服务器响应为:5.6.0 Invalid message content System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse) System.Net.Mail.DataStopCommand.Send(SmtpConnection conn) System.Net.Mail.SmtpClient.Send(MailMessage message) CallSite.Target(Closure , CallSite , Object , Object ) --- 内部异常堆栈跟踪的结尾--- System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo) CallSite.Target(Closure , CallSite , Object , Object ) System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) --- 内部异常堆栈跟踪的结尾--- Microsoft.Exchange.ProvisioningAgent.ScriptingAgentHandler.OnComplete(Boolean succeeded, Exception e) Microsoft.Exchange.Provisioning.ProvisioningLayer.OnCompleteImpl(Task task, Boolean succeeded, Exception exception)

    用户没有收到欢迎邮件。

    如上会是什么原因导致的呢?

    2015年9月21日 9:15

全部回复

  • System.Management.Automation.MethodInvocationException

    你确定所有邮件相关的feature 都打开了,有充分的权限吗?

    2015年9月30日 4:39