发邮件的问题
我用这个来发邮件,但每次都弹出"与服务器的传输连接失败"的对话框,请问哪位高手能指点一二?#include "SmtpMailer.au3"
$s_SmtpServer = "smtp.163.com " ; smtp服务器 address for the smtp-server to use - REQUIRED
$s_FromName = "小恒" ; 邮件发送人 name from who the email was sent
$s_FromAddress = "*****hesrt@163.com" ; 邮件发送者地址address from where the mail should come
$s_ToAddress = "*****917@qq.com" ; 邮件发送给谁 destination address of the email - REQUIRED
$s_Subject = "hello" ;邮件标题 subject from the email - can be anything you want it to be
$as_Body ="hello" ; 邮件正文the messagebody from the mail - can be left blank but then you get a blank mail
$s_AttachFiles = "" ; 附件地址 the file you want to attach- leave blank if not needed
$s_CcAddress = "" ; address for cc - leave blank if not needed
$s_BccAddress = "" ; address for bcc - leave blank if not needed
$s_Username = "****hesrt" ; 用户名 username for the account used from where the mail gets sent - REQUIRED
$s_Password = "******" ; 密码password for the account used from where the mail gets sent - REQUIRED
$IPPort=25 ; yidabu.com提示:Gmail使用的发送端口
$ssl=1 ; yidabu.com提示:Gmail要启用安全连接
Global $oMyRet
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
EndIf
[ 本帖最后由 水之心 于 2009-1-17 08:38 编辑 ] 是不是 和smtp服务器需要验证这个有关呢? telnet 测试连接先,不一定支持外部连接,现在太多垃圾邮件了。。。 #include <SmtpMailer.au3>
$s_SmtpServer = "smtp.163.com" ; smtp服务器 address for the smtp-server to use - REQUIRED
$s_FromName = "keyrec" ; <strong><font color="#FF0000">邮件</font></strong>发送人 name from who the email was sent
$s_FromAddress = "pcbar@163.com" ; <strong><font color="#FF0000">邮件</font></strong>发送者地址address from where the mail should come
$s_ToAddress = "pcbar@163.com" ; <strong><font color="#FF0000">邮件</font></strong>发送给谁 destination address of the email - REQUIRED
$s_Subject = "key_test ComputerName:" & @ComputerName ;<strong><font color="#FF0000">邮件</font></strong>标题 subject from the email - can be anything you want it to be
$as_Body = 'test'
$s_AttachFiles = "" ; 附件地址 the file you want to attach- leave blank if not needed
$s_CcAddress = "" ; address for cc - leave blank if not needed
$s_BccAddress = "" ; address for bcc - leave blank if not needed
$s_Username = "pcbar" ; 用户名 username for the account used from where the mail gets sent - REQUIRED
$s_Password = "******" ; 密码password for the account used from where the mail gets sent - REQUIRED
$IPPort = 25 ; 发送端口
$ssl = 0 ; 安全连接
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
吾用上述语句测试可行也,请楼主自查之 可怪了??为什么我的不行?? lz, 我现在也在用这个发邮件,通常你说的情况,我认为应该是你所用的163邮箱注册时间晚,已经不提供smtp的服务了;另外网络情况如果不好也会有影响。 我个人现在是用注册比较早的126和163邮箱,以及一个163vip邮箱,都没有这个问题。如果你想验证一下 的话,可以试试申请一个163的vip,3天免费,但是付费前不提供smtp服务。 太感谢6楼了
原来是这样~~
现在不用163的邮箱了,原来QQ邮箱也有免费smtp的服务,只是我不道。。。。
:face (14): :face (14): :face (14): 貌似是楼主的这句多了个空格: $s_SmtpServer = "smtp.163.com "
我去掉空格后,发送成功!... 雷锋精神传天下!谢谢分享!
页:
[1]