【问题标题】:What is the best way to send an email from a batch file?从批处理文件发送电子邮件的最佳方式是什么?
【发布时间】:2008-12-03 17:08:39
【问题描述】:

我有一个夜间批处理作业,可以判断它是否失败。我希望它向我发送一封电子邮件,如果它发送,可能带有附件。

如何从 Windows 批处理 (.bat) 文件发送电子邮件?

【问题讨论】:

    标签: windows email batch-file


    【解决方案1】:

    Blat。无需多言。 ;)

    【讨论】:

      【解决方案2】:

      如果安装了属于 IIS 的 SMTP 服务器,您可以使用 Echo 命令将文件写入拾取文件夹,然后将其发送出去。

      echo From: test@example.com>tmp.txt
      echo To: test@example.com>>tmp.txt
      echo Subject: hello>>tmp.txt
      echo.>>tmp.txt
      echo Hello world>>tmp.txt
      copy tmp.txt \Inetpub\mailroot\Pickup
      

      【讨论】:

      • 你会如何做附件?
      • 如果你想要附件,这不是这样的方式,使用 Blat 或其他东西。 (可能正在运行调用 CDOSYS 的 VBScript。)
      猜你喜欢
      • 2014-08-19
      • 2013-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-08
      • 2015-08-04
      • 2018-02-21
      相关资源
      最近更新 更多