Func SendEmail();CDO库是Windows系统默认带有的组件。Local $objEmail = ObjCreate("CDO.Message")With $objEmail; 设置发件人、收件人和主题.From = "发件人@163.com".To = "收件人@163.com".Subject = "test"; 设置邮件正文使用html格式,使用 & "<br>" & _ 实现换行.HtmlBody = "你好." & "<br>" & _"thank you, thank you very much." & "<br>" & _"thank you, thank you very much." & "<br>" & _"再见"; 添加附件.AddAttachment("D:\data\dedede.xlsx"); 设置SMTP服务器配置.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ; cdoSendUsingPort.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.163.com".Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True; 设置邮箱登录信息.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ; cdoBasic.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "发件人@163.com".Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "授权码,不是登录163邮箱密码"; 更新配置.Configuration.Fields.Update(); 发送邮件.SendEndWithEndFunc ;==>SendEmail; 调用发送邮件的函数 SendEmail() MsgBox(0, "Email", "邮件发送成功!")
3/SMTP模式即可