hi ,
i'm trying to sned a mail in my web (ASP.NET) ,i want to be able to send mails to my clients who have hotmail yahoo or gmail accounts....from different accounts also ....
in web.config
-
<system.net>
-
<mailSettings>
-
<smtp from="" deliveryMethod="network">
-
<network host="smtp.sigorta-online.com" port="25" defaultCredentials="true" />
-
</smtp>
-
</mailSettings>
-
</system.net>
my function is :
-
Public Shared Function SendMail(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strMsg As String) As Boolean
-
Try
-
' Create the mail message
-
Dim objMailMsg As MailMessage = New MailMessage(strFrom, strTo)
-
-
objMailMsg.BodyEncoding = Encoding.UTF8
-
objMailMsg.Subject = strSubject
-
objMailMsg.Body = strMsg
-
objMailMsg.Priority = MailPriority.High
-
objMailMsg.IsBodyHtml = True
-
-
'prepare to send mail via SMTP transport
-
Dim objSMTPClient As SmtpClient = New SmtpClient()
-
'objSMTPClient.EnableSsl = True
-
objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials
-
objSMTPClient.UseDefaultCredentials = True
-
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network
-
objSMTPClient.Send(objMailMsg)
-
Return True
-
Catch ex As Exception
-
Throw ex
-
End Try
-
End Function
it gives me this error message :
Mailbox unavailable. The server response was: <> No such user here
and when i put 'localhost" in my smtphost it gives me this error :
Failure sending mail.Unable to connect to the remote server
....any ideas ?