Powershell:无法使用 ControlM 发送电子邮件

问题描述

我可以在盒子上从命令行运行以下示例脚本,但在尝试从 controlm 运行相同脚本时遇到问题。

# mailtest.ps1
$cmd='Send-MailMessage -Body "body" -To "[email protected]" -From "[email protected]" -Subject "subject" -SmtpServer "smtpserver.net" -Port 25
Invoke-Expression $cmd

命令行 - 工作正常:

powershell -NoLogo -NonInteractive -File mailtest.ps1

ControlM - 错误:

powershell -NoLogo -NonInteractive -File mailtest.ps1

Send-MailMessage : Unable to read date from the transport connection: net_io_connectionclosed
...
+ FullyQualifiedErrorId : SmtpException,Microsoft.Powershell.Commands.SendMailMessage

网络在防火墙后面,但我认为这不是问题,因为邮件是从命令行发送的,没有任何问题。

到目前为止我尝试过的:

  • 已为 TLS 1.0、1.1、1.2 和 SSL 2.0、3.0 启用客户端/服务器
  • 尝试了端口号 - 25、587 和 465 - 它们都无法在 controlM 中工作
  • 也尝试使用 -NoProfile 和 Bypass 参数进行调用

任何关于我在这里遗漏的内容都会有很大帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)