을 PowerShell을 사용할 수있는 경우 Send-MailMessage 커맨드 쉽게로 배치 파일에서 호출 할 수있는 단일 한 줄 명령입니다 이메일 알림을 처리합니다. 다음은 PowerShell 스크립트를 호출하기 위해 배치 파일에 포함시킬 줄의 예제입니다 (%xVariable%
은 일괄 처리 파일에서 PowerShell 스크립트로 전달할 수있는 변수입니다).
- [BATCH FILE] - 아래
:: ...your code here...
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -command C:\MyScripts\EmailScript.ps1 %xVariable%
당신이 당신의 PowerShell 스크립트에 포함 할 수 있습니다 무엇의 예입니다 (당신은 당신이 당신의 배치 파일에서
%xVariable%
을 전달 포함 된 경우 스크립트의 첫 비 발언 라인으로 PARAM 라인을 포함해야합니다 :
- [POWERSHELL SCRIPT] -
Param([String]$xVariable)
# ...your code here...
$smtp = "smtp.[emaildomain].com"
$to = "[Send to email address]"
$from = "[From email address]"
$subject = "[Subject]"
$body = "[Text you want to include----the <br> is a line feed: <br> <br>]"
$body += "[This could be a second line of text]" + "<br> "
$attachment="[file name if you would like to include an attachment]"
send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml -Attachment $attachment -Priority high
[This] (http://www.msexchange.org/articles/sending-email-without-client.html)가 도움이 될 수 있습니다. 명령 줄에서 또는 텔넷을 사용하여 수행하는 방법을 설명합니다 – vaichidrewar
디렉터리 \ Inetpub \ mailroot \ pickup이 없으므로 픽업 방법이 작동하지 않습니다. 컴퓨터에 소프트웨어를 설치할 수 없으므로 blat 메서드가 작동하지 않습니다. 이 작업을 수동으로하고 싶지 않으므로 텔넷 방법이 작동하지 않습니다. 그리고 ASP가 없기 때문에이 방법은 효과가 없습니다. 다른 아이디어? – user448810
[Batch 파일에서 메일 보내기] (0120-385-301) –