我正在使用批處理程序,當發生崩潰或出現錯誤時,它會生成名爲debug.txt
的文本文件。我需要知道是否有一種方法可以使用批處理自動發送此文件到以下電子郵件地址「[email protected]
」。 debug.txt
與批處理文件位於同一位置。有誰知道我可以使用的代碼。它不能有任何額外的軟件。批量發送電子郵件
Q
批量發送電子郵件
-1
A
回答
1
我看到你的3個選項,截至目前:
的底線是有沒有在批量沒有內置的方式,但也有第三方的工具,如BLAT等,可以調用從一個批處理文件,但正如你所說,你不想要任何額外的軟件。
2.您可以啓用已安裝的Windows的SMTP服務器。然後運行PowerShell腳本:
$smtpServer = "system.abc.com"
$smtpFrom = "[email protected]"
$smtpTo = "[email protected]"
$messageSubject = "Put your subject here"
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.IsBodyHTML = $true
$message.Body = Get-Content debug.txt
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
可以啓用Windows的安裝SMTP服務器。然後運行一個VBScript:
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const FileToBeUsed = "debug.txt"
Dim objCDO1
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(FileToBeUsed, ForReading)
Set objCDO1 = CreateObject("CDO.Message")
objCDO1.Textbody = f.ReadAll
f.Close
objCDO1.TO ="[email protected]"
objCDO1.From = "[email protected]"
objCDO1.Subject = "Put your subject here"
objCDO1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration /sendusing") = 2
objCDO1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration /smtpserver") = "system.abc.com"
objCDO1.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration /smtpserverport") = 25
objCDO1.Configuration.Fields.Update
objCDO1.Send
Set f = Nothing
Set fso = Nothing
正如你所提到的,你使用的是Windows 7旗艦所以無論選擇2和3將您的系統上工作得很好。
0
您可以使用免費的工具,如sendemail.exe http://caspian.dotconf.net/menu/Software/SendEmail/。下載並將sendemail.exe複製到系統路徑。這僅適用於簡單的內部SMTP郵件。除非您的Exchange服務器設置爲發送匿名外部郵件,否則這不能用於發送外部郵件。幾乎所有的Exchange服務器都沒有設置爲執行此操作。
您可以在批處理腳本中使用這個簡單的例程。
CALL:SENDEMAILALERT "From SMTP address" "To SMTP addresses" "Subject" "Message" "File to attach" "smtp.host.com:25"
:SENDEMAILALERT
SET SENDEMAILCMD=-f "%~1"
SET SENDEMAILCMD=%SENDEMAILCMD% -t "%~2"
SET SENDEMAILCMD=%SENDEMAILCMD% -u "%~3"
SET SENDEMAILCMD=%SENDEMAILCMD% -m "%~4"
SET SENDEMAILCMD=%SENDEMAILCMD% -a "%~5"
SET SENDEMAILCMD=%SENDEMAILCMD% -s "%~6"
SENDEMAIL %SENDEMAILCMD% >NUL 2>&1
SET SENDEMAILCMD=
GOTO:EOF
+0
正如我在問題中所說的,我需要它不要包含任何額外的軟件。 – 09stephenb
相關問題
- 1. 批量發送大量電子郵件
- 2. 批量電子郵件發送回覆
- 3. 以PHP發送批量電子郵件
- 4. 以C#發送批量電子郵件#
- 5. WinRT的批量發送電子郵件
- 6. C#發送批量電子郵件
- 7. 批量發送電子郵件與SwiftMailer
- 8. 發送批量電子郵件
- 9. PHP發送批量電子郵件
- 10. 批量發送電子郵件(超過100個郵件)
- 11. 如何阻止我的電子郵件作爲批量電子郵件發送?
- 12. 將Excel鏈接到電子郵件。發送批量電子郵件
- 13. 如何發送批量電子郵件到不同的電子郵件ID
- 14. 發送多個電子郵件批次
- 15. java批量電子郵件發件人
- 16. PHP:批量發送大量電子郵件
- 17. 發送電子郵件操作不發送電子郵件
- 18. PHP發送電子郵件多次發送電子郵件
- 19. 發送批量郵件
- 20. 在Laravel 5.3中發送批量電子郵件
- 21. 發送沒有SMTP服務器的批量電子郵件
- 22. 如何通過ASP.NET向成員發送批量電子郵件?
- 23. 從SQL Server 2008發送批量電子郵件
- 24. 批量發送電子郵件,如何處理?
- 25. 通過php和codeigniter批量發送電子郵件
- 26. 尋找批量和事務性電子郵件發送服務
- 27. Google App Engine發送批量電子郵件
- 28. 使用phpmailer發送批量電子郵件
- 29. PHP:從查詢結果中發送批量電子郵件
- 30. 使用sendgrid在cakephp中批量發送電子郵件
如果我是你,我會從這個問題中刪除電子郵件地址,因爲無論如何都不需要它。 – zbr
由於是文字,您可以將其作爲郵件正文發送給他人。例如,'sendmail [options] [email_address]
lurker
@Zabri是對的。你不應該在任何公共論壇上發佈你的電子郵件。這是大量獲取垃圾郵件的主要方式。 – lurker