vbscript VBS - 邮件脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript VBS - 邮件脚本相关的知识,希望对你有一定的参考价值。

' Const schema = http://schemas.microsoft.com/cdo/configuration/smtpserver
Const cdoBasic = 2
' Const cdoSendUsingPort = 2


' Need arguments for : recipient, subject, attachment, Textbodyparams
Set args = WScript.Arguments
arg1 = args(0)
arg2 = args(1)
'arg2 = args(2)
'arg2 = args(3)
'arg2 = args(4)




Set emailObj      = CreateObject("CDO.Message")
emailObj.From     = "p.doulgeridis@dei.com.gr"
emailObj.To     = arg1
'emailObj.To       = "p.doulgeridis@dei.com.gr"
emailObj.Subject  = "Test CDO"
emailObj.TextBody = "Test CDO"

'emailObj.AddAttachment "C:\Users\p.doulgeridis\Desktop\zdm23108.XLS"
emailObj.AddAttachment arg2

Set emailConfig = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "holhub.intranet.dei.com.gr"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")    = 2  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")      = False 
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")    = "p.doulgeridis@intranet.dei.com.gr"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")    = "Doul2018"
emailConfig.Fields.Update

emailObj.Send

If err.number = 0 then Msgbox "Done"

以上是关于vbscript VBS - 邮件脚本的主要内容,如果未能解决你的问题,请参考以下文章

vbscript 存档文件的VBS脚本

怎么在游戏中使用vbs脚本

vbs到底做啥用的??

如何在vbs中设置可以在调用批处理脚本中读取的环境变量

vbscript VB脚本(http://www.kanaya440.com/contents/tips/vbs/008.html)ーートカットを作成する

我可以将参数传递给 VBScript(使用 cscript 启动的 vbs 文件)吗?