如何使用任务计划程序将电子邮件发送到Outlook中的通讯组列表? [英] How to send email to distribution list in outlook using task scheduler?
问题描述
为此,我经历了许多解决方案,但无法复制Outlook DL.我有以下要求.
I went through numerous solutions for this but couldn't replicate for outlook DLs. I have below requirement.
- 为testng.xml文件创建.bat文件,并在任何规定的时间使用任务计划程序运行.我已经完成了这个.
- 下一步是将testng报告发送到Outlook DL.我正在使用许多用户正在使用的远程桌面.
我该如何实现?我不想使用sendEmail.exe文件.
How can I achieve that? I don't want to use sendEmail.exe file.
有什么建议吗?
-
1.我尝试发送电子邮件(不建议使用),但出现此错误:-
任务测试发生错误.错误消息:以下 报告了错误.任务定义使用了不推荐使用的功能.
An error has occurred for task test. Error message: The following error was reported. The task definition uses a deprecated feature.
2.使用 https://mvnrepository.com/artifact/ch.fortysix/maven-postman-plugin/0.1.6 .但是为此,还会出现一些错误.
2. Using https://mvnrepository.com/artifact/ch.fortysix/maven-postman-plugin/0.1.6 . But for this also some error is coming up.
3.如果我使用的服务器桌面也被其他用户使用.他们将能够看到我的Outlook密码.如何摆脱这种情况?
推荐答案
您要执行的操作无效.
但是,您可以只使用 powershell Send-MailMessage
,它是Windows系统上的标准配置通过在批处理文件中运行它:
You could however just use powershell Send-MailMessage
which comes standard on a windows system by running it in a batchfile:
注意,它必须是Powershell 2.0或更高版本.
Note, It must be powershell 2.0 or later.
Send-MailMessage
-From "someone@someserver.net"
-To "whoever@gmail.com"
-Subject "Test email"
-Body "This is a test"
-SmtpServer Some_exhange_server_name\
出于可读性考虑,我使用换行符对文本进行了分解,但应该是一行.
I broke down the text using newlines for readability, but it should be a single line.
只需创建一个名为sendmail.ps1
之类的powershell文件并输入代码
Just create a powershell file called something like sendmail.ps1
and enter the code
Send-MailMessage -From "someone@someserver.net" -To "whoever@gmail.com" -Subject "Test email" -Body "This is a test" -SmtpServer some_exhange_Server_name
另外,发送带有附件的邮件.
additionally, to send mail with an attachment.
Send-MailMessage
-From "someone@someserver.net"
-To "whoever@gmail.com"
-Subject "Test email"
-Body "This is a test"
-SmtpServer Some_exhange_server_name\
-Attachments "c:\my files\file.log"
再次使用以下一行:
Send-MailMessage -From "someone@someserver.net" -To "whoever@gmail.com" -Subject "Test email" -Body "This is a test" -SmtpServer Some_exhange_server_name\ -Attachments "c:\my files\file.log"
这篇关于如何使用任务计划程序将电子邮件发送到Outlook中的通讯组列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!