如何通过批处理文件发送自动电子邮件? [英] how to send automated email through batch file?

查看:256
本文介绍了如何通过批处理文件发送自动电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI。



我有一个批处理文件,运行存储过程并生成一个csv文件。这是完美的工作,但我想发送相同的csv文件作为电子邮件附件,也是自动的。没有用户交互来发送报告。



我需要帮助通过任何将在日期运行的脚本发送相同的csv文件,我将在Windows任务调度程序中设置。



BATCH文件代码如下:



sqlcmd -Qexec SP_Report_EmailScheduler-S 195.168 .17.1 \SQLEXPRESS2012 -U sa -P abc -s,-W -d XYZ | findstr / V / C: - / B | replace-null.exe> C:\ yourOutput.csv



提前致谢。

HI.

I have a batch file which runs Stored procedure and generated a csv file.this is working perfectly but i want to send the same csv file as email attachment and that also automatically. No user interaction is there to send report.

I need help to send the same csv file through any script which will run on date which i will set in windows task scheduler.

BATCH file code is as under :

sqlcmd -Q "exec SP_Report_EmailScheduler" -S 195.168.17.1\SQLEXPRESS2012 -U sa -P abc -s, -W -d XYZ | findstr /V /C:"-" /B | replace-null.exe > C:\yourOutput.csv

Thanks in advance.

推荐答案

参见http://stackoverflow.com/questions/9038926/how-to -send-a-simple-email-from-a-windows-batch-file [ ^ ]。


这篇关于如何通过批处理文件发送自动电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆