Mail problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lukkynivas
    New Member
    • May 2007
    • 5

    Mail problem

    SmtpClient c = new SmtpClient("loc alhost",25);
    c.Send(new MailMessage("ad min@localhost", "admin@localhos t", "sub", "body"));

    I wrote above code asp.net 2.0 to send mail to local system
    O/S : Win XP
    Browser: IE6
    but iam getting this error, can any body help me
    Mailbox unavailable. The server response was: 5.7.1 Unable to relay for admin@localhost


    Thank U
    CNU
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by lukkynivas
    SmtpClient c = new SmtpClient("loc alhost",25);
    c.Send(new MailMessage("ad min@localhost", "admin@localhos t", "sub", "body"));

    I wrote above code asp.net 2.0 to send mail to local system
    O/S : Win XP
    Browser: IE6
    but iam getting this error, can any body help me
    Mailbox unavailable. The server response was: 5.7.1 Unable to relay for admin@localhost


    Thank U
    CNU
    Hi and welcome to TSDN. Hope you have a great time here.
    I'll move your question to the .NET forum.

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      My assumption is that admin@localhost is not a valid address.

      Comment

      • Atran
        Contributor
        • May 2007
        • 319

        #4
        Check this link:

        Quick Reference on how to send an email using .NET

        Comment

        • lukkynivas
          New Member
          • May 2007
          • 5

          #5
          thank u for ur reply
          when i write as below
          SmtpClient c = new SmtpClient("vcd 06005.vija.com" ,25);
          c.Send(new MailMessage("ad min@vcd06005.vi ja.com", "admin@vcd06005 .vija.com", "sub", "body"));
          i am getting that msgs are staying in c:\inetpub\mail root\drop without any errors

          here
          vcd06005 is my computer name
          vija.com is my domain in local area network

          but if write like below code i am getting error
          SmtpClient c = new SmtpClient("loc alhost",25);
          c.Send(new MailMessage("ad min@localhost", "admin@localhos t", "sub", "body"));

          i hope u'll let me know the reason and solution
          thank u
          CNU

          Comment

          • radcaesar
            Recognized Expert Contributor
            • Sep 2006
            • 759

            #6
            Localhost will not be equal to vcd06005.vija.c om. Its a term refers to ur system where iis is installed. By default it refers to the IP 127.0.0.1.

            Try this, http://127.0.0.1:80 (80 is default port)

            Clear now ?

            RE me if not....

            :)

            Originally posted by lukkynivas
            thank u for ur reply
            when i write as below
            SmtpClient c = new SmtpClient("vcd 06005.vija.com" ,25);
            c.Send(new MailMessage("ad min@vcd06005.vi ja.com", "admin@vcd06005 .vija.com", "sub", "body"));
            i am getting that msgs are staying in c:\inetpub\mail root\drop without any errors

            here
            vcd06005 is my computer name
            vija.com is my domain in local area network

            but if write like below code i am getting error
            SmtpClient c = new SmtpClient("loc alhost",25);
            c.Send(new MailMessage("ad min@localhost", "admin@localhos t", "sub", "body"));

            i hope u'll let me know the reason and solution
            thank u
            CNU

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              When it says "cannot relay" it is telling you that the user you have picked is not local to that server and your mail server is not routing email to them
              (I find this happens when I don't authenticate with the smtp server)

              Comment

              Working...