VB 全自动 无窗口 发送邮件

来源:百度知道 编辑:UC知道 时间:2024/06/18 17:01:26
VB 实现全自动 无窗口 发送邮件,好的追加20分

设置窗口运行后隐藏。

以下是vbs脚本示例
'Send Email
Dim ToAddress, MessageSubject, MessageBody, MessageAttachment
Dim ol, ns, newMail

ToAddress = "John Smith"
MessageSubject = "Write the subject here"
MessageBody = "Write the message body here"

Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
ns.logon "","",true,false
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf

' Validate the recipient, just in case...
Set myRecipient = ns.CreateRecipient(ToAddress)
myRecipient.Resolve
If Not myRecipient.Resolved Then
MsgBox "unknown recipient"
Else
newMail.Recipients.Add(myRecipient)
newMail.Send
End If

Set ol = Nothing

20分太少了。200分吧。200分立马给你。

无窗口在VB里面设置就可以了.