westmood 发表于 2016-9-14 15:07:04

为什么 不能发邮件?同样的语句VBS可以发

#Include<file.au3>
#include <MsgBoxConstants.au3>

;============================PW===================================

        Local $sNum = ""
        Local $sText = ""
        Local $sTextU = ""

        For $i = 1 To 8
                $sNum &= Chr(Random(48, 57, 1))
        Next

        For $j = 1 To 1
                $sTextU &= Chr(Random(65,90,1))
        Next

        For $j = 1 To 2
                $sText &= Chr(Random(97,122,1))
        Next

$PW = $sTextU & $sText & "@" &$sNum


MsgBox($MB_SYSTEMMODAL, "", "The random PW of text was: " & $PW)

;============================PW===================================


$SmtpServer = "smtp.21cn.com"
$FromName = "********@21cn.com"
$FromAddress = "********@21cn.com"
$ToAddress = "********@icloud.com"
$Subject = "FUO External Visitor WIFI PassWord"
$Body = "The random PW of FUO External Visitor WIFI was:                        " & $PW
$AttachFiles = ""
$CcAddress = "*******@qq.com"
$BccAddress = "********@outlook.com"
$Importance = "Normal"
$Username = "********@21cn.com"
$Password = "*************"
$IPPort = 25
$ssl = 0

Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = $FromAddress
$objEmail.To = $ToAddress
$objEmail.cc = $CcAddress
$objEmail.bcc = $BccAddress
$objEmail.Subject = $Subject
$objEmail.Textbody = $Body

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $SmtpServer
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $Password
$objEmail.Configuration.Fields.Update

MsgBox($MB_SYSTEMMODAL, "", $Body)
$objEmail.Send

大叔 发表于 2016-9-18 13:56:43

本帖最后由 大叔 于 2016-9-18 13:57 编辑

建议你在论坛内搜索一下SmtpMailer.au3#include <SmtpMailer.au3>

heroxianf 发表于 2016-9-18 14:27:48

回复 2# 大叔


    这个是不是很简单就可以发邮件了?

大叔 发表于 2016-9-18 17:14:47

回复 3# heroxianf

高手已经写好代码.只需会调用就可以了
页: [1]
查看完整版本: 为什么 不能发邮件?同样的语句VBS可以发