Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Mail sending problem

Mail sending problem

Scheduled Pinned Locked Moved ASP.NET
helpsysadmincsharpcom
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lijo Rajan
    wrote on last edited by
    #1

    Hai all, In my application i am using System.Net.Mail for sending mail. for that i have used the code as given below. MailMessage mail = new MailMessage(); MailAddress To = new MailAddress("lijorajan2004@gmail.com"); mail.To.Add(To); mail.Body = "Hai"; MailAddress From = new MailAddress("lijo@ourdomain.com"); mail.From = From; SmtpClient client = new SmtpClient("smtp.myserver.com"); client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Host = "hostname";//host name is our remote ip address client.UseDefaultCredentials = false; client.Send(mail); here the problem is i am able to send mail to my lijo@mydomain.com(it is our own domain).but i am not able to send mail to other domain(lijorajan2004@gmail.com); here i am getting error like "Mailbox unavailable. The server response was: 5.7.1 Unable to relay for lijorajan2004@gmail.com" plse help me. Thanks in advance. Regds Lijo

    G 1 Reply Last reply
    0
    • L Lijo Rajan

      Hai all, In my application i am using System.Net.Mail for sending mail. for that i have used the code as given below. MailMessage mail = new MailMessage(); MailAddress To = new MailAddress("lijorajan2004@gmail.com"); mail.To.Add(To); mail.Body = "Hai"; MailAddress From = new MailAddress("lijo@ourdomain.com"); mail.From = From; SmtpClient client = new SmtpClient("smtp.myserver.com"); client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Host = "hostname";//host name is our remote ip address client.UseDefaultCredentials = false; client.Send(mail); here the problem is i am able to send mail to my lijo@mydomain.com(it is our own domain).but i am not able to send mail to other domain(lijorajan2004@gmail.com); here i am getting error like "Mailbox unavailable. The server response was: 5.7.1 Unable to relay for lijorajan2004@gmail.com" plse help me. Thanks in advance. Regds Lijo

      G Offline
      G Offline
      Ghazi H Wadi
      wrote on last edited by
      #2

      Your server is not allowed to relay messages that are not (either from one of it's users or to one of it's user's inbox) So to send the message either the sender or the receiver has to be from the server's (i.e. me@myserver.com) Nothing wrong with your code. Just the test email addresses need to be reviewed. Cheers Raz

      /* Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA */

      L 1 Reply Last reply
      0
      • G Ghazi H Wadi

        Your server is not allowed to relay messages that are not (either from one of it's users or to one of it's user's inbox) So to send the message either the sender or the receiver has to be from the server's (i.e. me@myserver.com) Nothing wrong with your code. Just the test email addresses need to be reviewed. Cheers Raz

        /* Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA */

        L Offline
        L Offline
        Lijo Rajan
        wrote on last edited by
        #3

        Hi, Thank u verymuch for ur reply.If u dont mind could u plse tell me in detail how i can solve this problem? this is my webconfig file plse help me. regrds Lijo

        B 1 Reply Last reply
        0
        • L Lijo Rajan

          Hi, Thank u verymuch for ur reply.If u dont mind could u plse tell me in detail how i can solve this problem? this is my webconfig file plse help me. regrds Lijo

          B Offline
          B Offline
          Braulio Dez
          wrote on last edited by
          #4

          You have to check with your SMTP provider. Before checking with .net code, you can directly make it via telnet: If telnet doesn't work then there is an issue in your code, if not is an issue with your SMTP provider. Take a look at: http://msexchangeteam.com/archive/2006/07/14/428324.aspx[^] A compilation about SMTP material: http://www.tipsdotnet.com/ArticleBlog.aspx?KWID=45&Area=SMTP&PageIndex=0[SMTP Articles]

          /// -------------------------      Braulio Díez      tipsdotnet.com /// -------------------------

          G 1 Reply Last reply
          0
          • B Braulio Dez

            You have to check with your SMTP provider. Before checking with .net code, you can directly make it via telnet: If telnet doesn't work then there is an issue in your code, if not is an issue with your SMTP provider. Take a look at: http://msexchangeteam.com/archive/2006/07/14/428324.aspx[^] A compilation about SMTP material: http://www.tipsdotnet.com/ArticleBlog.aspx?KWID=45&Area=SMTP&PageIndex=0[SMTP Articles]

            /// -------------------------      Braulio Díez      tipsdotnet.com /// -------------------------

            G Offline
            G Offline
            Ghazi H Wadi
            wrote on last edited by
            #5

            I second Braulio's openion. As amatter of fact about 9-10 years ago a list of servers that allows relaying was published as ablack list. This was to prevent and fight spamming. Many email servers rejected any messages comming from servers on the list. So how can you do that: you need to be able to find the MX record of the DNS entry for each recepient, or have an account at the server you are using and then use that account to send your messages. It is not a coding issue. It is a protocol limitation. Cheers Raz

            /* Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA */

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups