发送邮件的问题,如何设置登陆smtp用户名和密码
请问我这个邮件为什么发不出去???
提示错误:与服务器的传输连接失败
<% @ 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>