发送邮件的问题,如何设置登陆smtp用户名和密码

zzyyjj 2004-05-10 05:00:11
请问我这个邮件为什么发不出去???
提示错误:与服务器的传输连接失败
<% @ import Namespace="System.Web.Mail"%>
<html>
<body>

<asp:Label id="lblMailStatus1" runat="server" />

</body>
</html>
<%@ Page Language="VB" %>

<script language="VB" runat="server">

Sub Page_Load()
'CREATE A MAIL MESSAGE
Dim myEmail as MailMessage =new MailMessage()

'SET MESSAGE PARAMETERS
myEmail.From = "agent@mypersonalshoppers.com"
myEmail.To = "zhuangyajun@126.com"
myEmail.Subject = "Product Availability Notice"
myEmail.BodyFormat = System.Web.Mail.MailFormat.Html
myEmail.Body = "The sunglasses you expressed interest in are now in

stock."
myEmail.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")

myEmail.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/sendusername",

"CSU@126.com") 'SMTP 用户

myemail.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123321")

'SMTP 密码

myemail.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/smtpserver",

"smtp@126.net") 'SMTP服务器

'SEND THE MESSAGE
System.Web.Mail.SmtpMail.Send(myEmail)

'UPDATE STATUS
lblMailStatus1.Text = "Mail successfully sent."
End Sub

</script>

<html>
<body>
...全文
772 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
csu_zyj 2004-09-28
  • 打赏
  • 举报
回复
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") ‘方式
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","xiaocainiao")‘用户
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "520")‘密码

SmtpMail.SmtpServer = "smtp.163.com" ‘服务器
sxb_8000 2004-08-17
  • 打赏
  • 举报
回复
借楼主的地盘问一下,如果是后台发送,又该怎么写?
zergcom 2004-08-06
  • 打赏
  • 举报
回复
System.Web.Mail支持验证,只是有点乖,楼上正解
strXiaoCaiNiao 2004-08-06
  • 打赏
  • 举报
回复
("http://schemas.microsoft.com/cdo/configuration/smtpserver",

"smtp@126.net") 'SMTP服务器

改为
("http://schemas.microsoft.com/cdo/configuration/smtpserver",

"smtp.126.net") 'SMTP服务器

试一下
strXiaoCaiNiao 2004-08-03
  • 打赏
  • 举报
回复
vb.net写的,希望对您有些帮助

加上验证和服务器试一下:
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") ‘方式
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","xiaocainiao")‘用户
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "520")‘密码

SmtpMail.SmtpServer = "smtp.163.com" ‘服务器
ALong_Yue 2004-05-10
  • 打赏
  • 举报
回复
System.Web.Mail不支持验证。
可以用CDO发送邮件。网上资料很多,自己Google一下把:)

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧