找回密码
 加入
搜索
查看: 1651|回复: 3

[AU3基础] 为什么 不能发邮件?同样的语句VBS可以发

[复制链接]
发表于 2016-9-14 15:07:04 | 显示全部楼层 |阅读模式
#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>
发表于 2016-9-18 14:27:48 | 显示全部楼层
回复 2# 大叔


    这个是不是很简单就可以发邮件了?
发表于 2016-9-18 17:14:47 | 显示全部楼层
回复 3# heroxianf

高手已经写好代码.  只需会调用就可以了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-23 13:13 , Processed in 0.079752 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表