function Send_mail(You_Account,You_Password,Send_Email,Send_Email2,Send_Topic,Send_Body,Send_Attachment)
You_ID=Split(You_Account, "@", -1, vbTextCompare)
MS_Space = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = You_Account
Email.To = Send_Email
If Send_Email2 <> "" Then
Email.CC = Send_Email2
End If
Email.Subject = Send_Topic
Email.Textbody = Send_Body
If Send_Attachment <> "" Then
Email.AddAttachment Send_Attachment
End If
With Email.Configuration.Fields
.Item(MS_Space&"sendusing") = 2
.Item(MS_Space&"smtpserver") = "smtp."&You_ID(1)
.Item(MS_Space&"smtpserverport") = 25
.Item(MS_Space&"smtpauthenticate") = 1
.Item(MS_Space&"sendusername") = You_ID(0)
.Item(MS_Space&"sendpassword") = You_Password
.Update
End With
Email.Send
Set Email=Nothing
Send_Mail=True
If Err Then
Err.Clear
Send_Mail=False
End If
End Function
If Send_Mail("sss852@163.com","xxxxxx","other@qq.com","","邮件主题","Some code from vbs","")=True Then
Wscript.Echo "发送成功"
Else
Wscript.Echo "发送失败"
End If