sark 发表于 2008-9-6 17:27:58

_INetSmtpMail设置后报错!

_INetSmtpMail设置后报错!
不知道为什么!
请大侠指出!
谢谢!


源码如下:
#include <INet.au3>

$s_SmtpServer = "smtp.gmail.com"
$s_FromName = "My Name"
$s_FromAddress = "*@gmail.com";*帐号
$s_ToAddress = "*@gmail.com";*帐号
$s_Subject = "My Test UDF"
Dim $as_Body
$as_Body = "Testing the new email udf"
$as_Body = "Second Line"
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
$err = @error
If $Response = 1 Then
    MsgBox(0, "Success!", "Mail sent")
Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf

[ 本帖最后由 sark 于 2008-9-19 20:12 编辑 ]

sark 发表于 2008-9-9 16:32:20

没人回答!顶一下!

所所思 发表于 2008-9-9 17:18:41

$err是什么?
@ERROR = 1 - Invalid Parameters
    @ERROR = 2 - Unable to start TCP
    @ERROR = 3 - Unable to resolve IP
    @ERROR = 4 - Unable to create socket
    @ERROR = 5x - Cannot open SMTP session. x indicates the index number of last command issued to the SMTP server.
    @ERROR = 50x - Cannot send body. x indicates the line number of $as_Body (first line is 0).
    @ERROR = 5000 - Cannot close SMTP session

还有 gmail的smtp服务器需要登陆才可以用

所所思 发表于 2008-9-9 17:23:11

我刚才试了一下 提示错误代码4无法创建socket

bob 发表于 2008-9-9 17:27:59

现在的SMTP一般都需要验证的,_INetSmtpMail这个函数现在没多大用处了,如果需要的话,可以看看这篇,支持GMAIL
http://www.1msoft.com/column/UDF-hanshu/SmtpMailer.html
页: [1]
查看完整版本: _INetSmtpMail设置后报错!