469,926 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

send automatic mail

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
Expand|Select|Wrap|Line Numbers
  1. <system.net>
  2.     <mailSettings>
  3.       <smtp from="" deliveryMethod="network">
  4.         <network host="smtp.sigorta-online.com" port="25"  defaultCredentials="true" />
  5.       </smtp>
  6.     </mailSettings>
  7.   </system.net>
my function is :
Expand|Select|Wrap|Line Numbers
  1.  Public Shared Function SendMail(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strMsg As String) As Boolean
  2.         Try
  3.             ' Create the mail message
  4.             Dim objMailMsg As MailMessage = New MailMessage(strFrom, strTo)
  5.  
  6.             objMailMsg.BodyEncoding = Encoding.UTF8
  7.             objMailMsg.Subject = strSubject
  8.             objMailMsg.Body = strMsg
  9.             objMailMsg.Priority = MailPriority.High
  10.             objMailMsg.IsBodyHtml = True
  11.  
  12.             'prepare to send mail via SMTP transport
  13.             Dim objSMTPClient As SmtpClient = New SmtpClient()
  14.             'objSMTPClient.EnableSsl = True
  15.             objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials
  16.             objSMTPClient.UseDefaultCredentials = True
  17.             objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network
  18.             objSMTPClient.Send(objMailMsg)
  19.             Return True
  20.         Catch ex As Exception
  21.             Throw ex
  22.         End Try
  23.     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 ?
Oct 2 '09 #1
0 1489

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by David Burson | last post: by
5 posts views Thread by Andy G | last post: by
2 posts views Thread by zek2005 | last post: by
2 posts views Thread by Senthilkumar | last post: by
reply views Thread by Tidan | last post: by
1 post views Thread by refv8 | last post: by
4 posts views Thread by navyliu | last post: by
5 posts views Thread by pat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.