这是我的aspx.vb页面........................................ .................................................. .......................
Imports System.Web.Mail
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Const ToAddress As String = "paul.ramirez@att.net"
Dim objMM As New MailMessage("paramireze@gmail.com", ToAddress)
Dim smtp As New SmtpClient
objMM.IsBodyHtml = False
objMM.Priority = MailPriority.Normal
objMM.Subject = "Hello there!"
objMM.Body = "Hi!" & vbCrLf & vbCrLf & "How are you doing?"
smtp.Send(objMM)
end sub
............................................... .................................................. .................................................. .......
我的aspx页面包含以下内容...没有括号
(<%@Import Namespace="System.Web.Mail" %>
)
web.config文件如下(遗憾的是,它不会显示大于小于符号。
<configSections>
<system.net>
<mailSettings>
<smtp>
<network host="relay-hosting.secureserver.net" port="25">
</smtp>
</mailSettings>
</system.net>
</configSections>
godaddy.com的人告诉我,我需要的唯一信息是relayServer主机名,即relay-hosting.secureserver.net,不需要用户名和密码。
感谢您的帮助
答案 0 :(得分:2)
我认为这是你的问题。将邮件服务器端口从端口80更改为web.config中的端口25
尝试使用此代码块:
Dim objMailMessage As New System.Net.Mail.MailMessage
With objMailMessage
.IsBodyHtml = False
.From = New MailAddress("fromaddress@youremailaccount.com")
.To.Add("destinationaddress@whoever.com") .Subject = "Your Subject"
.Body = "Body Text"
End With
Dim objSMTPClient As New System.Net.Mail.SmtpClient("relay-hosting.secureserver.net", 25)
objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network
objSMTPClient.Send(objMailMessage)
这是线程和其他一些例子。这听起来似乎有一个godaddy设置在某个地方,但我不记得在我的最后改变任何东西。
答案 1 :(得分:1)
我认为问题在于您无法从域外的地址发送来自godaddy的电子邮件。尝试从您域中的某个注册电子邮件地址发送。