gpt4 book ai didi

email - 通过 VBS 脚本发送电子邮件

转载 作者:行者123 更新时间:2023-12-04 17:21:42 28 4
gpt4 key购买 nike

我正在尝试通过 VBS 发送电子邮件,但我不断收到错误消息。我希望它尽可能简单地发送电子邮件。
不起作用,出现此错误:

        Set objEmail = CreateObject("CDO.Message")
objEmail.From = "othermail@hey.com"
objEmail.To = "myemail@yahoo.com"
objEmail.Subject = "thisisasubject"
objEmail.Textbody = "Here is the message"
objEmail.Send
错误:

line: 6

Char: 1 error: The "sendusing"configuration value is invalid. 80040220

最佳答案

Set emailObj      = CreateObject("CDO.Message")

emailObj.From = "dc@gail.com"
emailObj.To = "dc@gail.com"

emailObj.Subject = "Test CDO"
emailObj.TextBody = "Test CDO"

Set emailConfig = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "YourUserName"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password1"

emailConfig.Fields.Update

emailObj.Send

If err.number = 0 then Msgbox "Done"

关于email - 通过 VBS 脚本发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21973581/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com