找回密码
 加入
搜索
查看: 8030|回复: 8

发邮件的问题

[复制链接]
发表于 2009-1-16 12:48:50 | 显示全部楼层 |阅读模式
我用这个来发邮件,但每次都弹出"与服务器的传输连接失败"的对话框,请问哪位高手能指点一二?

#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[2] 
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 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-1-16 13:56:06 | 显示全部楼层
是不是 和  smtp服务器需要验证  这个有关呢?
发表于 2009-1-16 14:54:32 | 显示全部楼层
telnet 测试连接先,不一定支持外部连接,现在太多垃圾邮件了。。。
发表于 2009-1-16 19:49:29 | 显示全部楼层
#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)

吾用上述语句测试可行也,请楼主自查之
 楼主| 发表于 2009-1-16 22:13:22 | 显示全部楼层
可怪了??为什么我的不行??
发表于 2009-1-17 00:32:28 | 显示全部楼层
lz, 我现在也在用这个发邮件,通常你说的情况,我认为应该是你所用的163邮箱注册时间晚,已经不提供smtp的服务了;另外网络情况如果不好也会有影响。   我个人现在是用注册比较早的126和163邮箱,以及一个163vip邮箱,都没有这个问题。如果你想验证一下 的话,可以试试申请一个163的vip,3天免费,但是付费前不提供smtp服务。
 楼主| 发表于 2009-1-17 08:38:19 | 显示全部楼层
太感谢6楼了
原来是这样~~
现在不用163的邮箱了,原来QQ邮箱也有免费smtp的服务,只是我不道。。。。
发表于 2011-12-21 18:10:07 | 显示全部楼层
貌似是楼主的这句多了个空格:   $s_SmtpServer = "smtp.163.com "
我去掉空格后,发送成功!...
发表于 2014-5-15 08:51:19 | 显示全部楼层
雷锋精神传天下!谢谢分享!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-16 21:21 , Processed in 0.089740 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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