Email Help please

Discussion in 'ASP.NET 2.0' started by bjose, Feb 28, 2007.

  1. Hi,
    I am using asp.net 2
    My web.config file setting are



    <system.net>


    <mailSettings>


    <smtp from="[email protected]">


    <network host="localhost" defaultCredentials="true" />


    </smtp>


    </mailSettings>


    </system.net>





    But when I try to register / retrieve password, I am getting following error.
    Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected]


    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected]

    Source Error:





    Code:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:





    Code:
    [SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email][email protected][/email]]
       System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException&amp; exception) +704
       System.Net.Mail.SmtpClient.Send(MailMessage message) +2184
       System.Web.UI.WebControls.LoginUtil.SendPasswordMail(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +482
       System.Web.UI.WebControls.PasswordRecovery.AttemptSendPasswordUserNameView() +753
       System.Web.UI.WebControls.PasswordRecovery.AttemptSendPassword() +80
       System.Web.UI.WebControls.PasswordRecovery.OnBubbleEvent(Object source, EventArgs e) +136
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +178
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838
    

    I appreciate if any one faced same problem could help me in this.


    Thanks in anticipation


    B Jose
     
  2. My code also not able to send email. There is no visible error, but not getting emails to the specified email account. Is there anything to enable on server?


    anyone, please adivce.


    My code snippet:


    Dim ToEmail As String = Email.Text
    Dim ToName As String = contactusFname.Text &amp; ", " &amp; contactusLname.Text
    Dim smtp As New System.Net.Mail.SmtpClient
    smtp.Host = "localhost"
    Dim msg As New System.Net.Mail.MailMessage()
    With msg
    .From = New System.Net.Mail.MailAddress("Team, HappyNRI <[email protected]>")
    .Body = "Test Email "
    .Subject = "Thank You for contacting us"
    .IsBodyHtml = True
    .To.Add(New System.Net.Mail.MailAddress(ToEmail, ToName))
    .CC.Add(New System.Net.Mail.MailAddress("[email protected]"))
    .Priority = Net.Mail.MailPriority.High




    End With


    smtp.Send(msg)


    It was working with other hosters, when I moved to discountasp, seems need to do some workaround..





    Please help


    B Jose
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. Hey Bruce

    Joke of the day...

    This is not the solution.. and this is not yahoo error, but SMTP error.. just go to google and try, you will get lots of links..

    I am looking for some serious replys / technical support, not kidding.

    If you want I can give you this yahoo id password, you can check the ID exists, or send an email to this id, I will reply.


    I know this is the error, whic related to SMTP authentication at discountASP server.

    Thanks
    B Jose
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    hey buddy.. you don't need to be sarcastic, i am just trying to help here.

    The localhost server is IIS SMTP service and it does not use SMTP auth but rather IP restriction.

    I have no idea why it returns this error message but the error is flawed if the email address is valid.

    I suggest you try the sample at http://kb.discountasp.net/article.aspx?id=10443 . I can guarantee that this sample code will work fine.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. Thanks a lot guys..

    It is solved
    B Jose
     
  7. I'm just taking guesses here, but try changing your FROM address from this...


    .From = New System.Net.Mail.MailAddress("Team, HappyNRI <[email protected]>")

    to this...


    .From = New System.Net.Mail.MailAddress("[email protected]", "Team, HappyNRI")



    Also, try removing the CC field, see if that helps at all.



    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     

Share This Page