Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 发送以前有效的邮件时出错_Powershell_Email - Fatal编程技术网

Powershell 发送以前有效的邮件时出错

Powershell 发送以前有效的邮件时出错,powershell,email,Powershell,Email,下面是用于发送邮件的代码段。它一直工作到最近,并给出“发送邮件失败”错误。(版本:5.1.16299.98) 错误是: Exception calling "Send" with "1" argument(s): "Failure sending mail." At F:\powershell_scripts\xxx.ps1 :88 char:1 + $smtp.Send($message) + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo :

下面是用于发送邮件的代码段。它一直工作到最近,并给出“发送邮件失败”错误。(版本:5.1.16299.98)

错误是:

Exception calling "Send" with "1" argument(s): "Failure sending mail." At F:\powershell_scripts\xxx.ps1 :88 char:1 + $smtp.Send($message) + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SmtpException 使用“1”参数调用“发送”时出现异常:“发送邮件失败。” 位于F:\powershell\u scripts\xxx.ps1:88字符:1 +$smtp.Send($message) + ~~~~~~~~~~~~~~~~~~~~ +CategoryInfo:NotSpecified:(:)[],MethodInvocationException +FullyQualifiedErrorId:SmtpException 我不能告诉你问题出在哪里,但我可以帮助你找到更多关于错误的信息

try {
   <your code>
}
catch {
    Write-Warning $Error[0].Exception.StackTrace
    throw
}
从那里开始

希望这有助于您了解这一[以及未来]问题的真相!

我无法告诉您问题所在,但我可以帮助您了解有关错误的更多信息

try {
   <your code>
}
catch {
    Write-Warning $Error[0].Exception.StackTrace
    throw
}
从那里开始


希望这有助于您了解这个[以及未来]问题的真相!

您是否尝试在google设置中打开不太安全的应用程序,但网络凭据部分出现了键入错误
tial($Username,$Password);
(我假设这是在将代码粘贴到stackoverflow时发生的)我已经完成了所有必要的设置。当我将调试器放在错误行上,等待并运行它时,这有时会起作用。以前用于正常工作。此
$smtp.EnableSSL=$true.tial($Username,$Password);
毫无意义。缺少某些内容。这是一个复制粘贴错误吗?您是否实际在ISE中运行它?为代码粘贴过程中的错误道歉,编辑上面的代码您是否尝试在google设置中打开不太安全的应用程序,并且网络凭据部分出现键入错误
tial($Username,$Password);
(我假设这是在将代码粘贴到stackoverflow时发生的)我已经完成了所有必要的设置。当我将调试器放在错误行上时,这有时会起作用,请等待,然后运行它。以前用于正常工作。此
$smtp.EnableSSL=$true.tial($Username,$Password);
毫无意义。缺少某些内容。这是一个复制粘贴错误吗?您是否实际在ISE中运行它?对代码粘贴过程中的错误表示歉意,在上面编辑代码,尝试您的建议,我得到了;警告:在System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext,Exception Exception Exception)位于System.Management.Automation.解释器.ActionCallInstruction`2.在System.Management.Automation.解释器.EntertryCatch FinallyInstruction.Run(解释器框架)位于System.Management.Automation.解释器.EntertryCatch FinallyInstruction.Run(I InterpretectedFrame)gvee,尝试了你的建议,我得到了;警告:在System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext,Exception Exception)在System.Management.Automation.解释器.ActionCallInstruction`2.运行(解释edFrame)在System.Management.Automation.Translator.EnterTryCatchFinallyInstruction.Run(解释器框架)在System.Management.Automation.Translator.EnterTryCatchFinallyInstruction.Run(InterpretedFrame框架)在System.Management.Automation.Translator.EnterTryCatchFinallyInstruction.Run(InterpretedFrame框架)
$Error | Get-Member