求助,怎样用bat发送邮件
1个回答
展开全部
给你一个VBS版的发邮件脚本,其中相关内容请自行修改设置
'vbs发邮件 By 依梦琴瑶
'设置发信人邮箱地址
Sender = "My Email Address"
'设置发信人邮箱密码
Sender_PassWord = "My Email Password"
'设置发信人邮箱SMTP服务器地址
Smtp = "My Email Smtp"
'设置SMTP服务器端口
Port = 25
'设置收信人邮箱地址
Receiver = "Recipient's address"
'设置附件文件路径。
Attachment = "VBS_Email_Test.txt"
'设置邮件主题
Subject = "邮件主题"
'设置正文文本路径。
Text = "VBS_Email_Test.txt"
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = Sender
Email.To = Receiver
Email.Subject = Subject
Email.Textbody = CreateObject("Scripting.FileSystemObject").OpenTextFile(Text,1,Ture).readall
Email.AddAttachment Attachment
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = Smtp
.Item(NameSpace&"smtpserverport") = Port
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = Sender
.Item(NameSpace&"sendpassword") = Sender_PassWord
.Item(NameSpace&"smtpconnectiontimeout") = 60
.Update
End With
Email.Send
Set Email=Nothing
注意:发信人的邮箱必须已开启SMTP服务才可以发邮件哦!
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询