I have written a code in asp.net 2.0 and tested that in a web site to send emils to users, but it fails. The error message is:
Not Local host yahoo.com, not gateway.
How can I solve this problem. Do I need Authentication? If so, how shaould I do it? The Code is:
Dim objSMTP As New SmtpClient(%26quot;mail.mydomian.com%26quot;)
Dim mailSubject As String = txtSubject.Text
Dim mailBody As String = txtBody.Text
Dim objMailMsg As New MailMessage(%26quot;support@mydomain.com%26quot;, txtTo.Text)
objMailMsg.Subject = mailSubject
objMailMsg.Body = mailBody
objSMTP.Send(objMailMsg)
objMailMsg.Dispose()
How can I send an Email in my web site using ASP.NET 2.0?
The SMTP server that you specified in the first line may need authentication. Many SMTP servers don%26#039;t need authentication but only send mail for certain people, such as an ISP%26#039;s server that only sends mail for its customers. You%26#039;ll need to contact the owner of that SMTP server.
You may have removed this from the code you posted, but you haven%26#039;t given the MailMessage a From or To address.
Dan
http://easiersoftware.blogspot.com
No comments:
Post a Comment