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. General Programming
  3. C#
  4. Authorization Problem

Authorization Problem

Scheduled Pinned Locked Moved C#
helpquestioncsharphtmlcom
11 Posts 5 Posters 0 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.
  • S Offline
    S Offline
    Semion_N
    wrote on last edited by
    #1

    I wrote this class: public class Send_Mail { public void send() { string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); //client.UseDefaultCredentials = true; client.Send(message); } } When I run it I have the following problem: An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http://www.mail.ru/pages/help/261.html for details. How do I authorize the account?

    SnaidiS(Semion)

    L S 2 Replies Last reply
    0
    • S Semion_N

      I wrote this class: public class Send_Mail { public void send() { string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); //client.UseDefaultCredentials = true; client.Send(message); } } When I run it I have the following problem: An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http://www.mail.ru/pages/help/261.html for details. How do I authorize the account?

      SnaidiS(Semion)

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Semion_N wrote:

      How do I authorize the account?

      They hide that information in the documentation[^] :rolleyes:

      led mike

      S 1 Reply Last reply
      0
      • L led mike

        Semion_N wrote:

        How do I authorize the account?

        They hide that information in the documentation[^] :rolleyes:

        led mike

        S Offline
        S Offline
        Semion_N
        wrote on last edited by
        #3

        I don't really understand how to use that I write client.Credentials = and then what? for example if my user name is: abcd and password: efg ?

        SnaidiS(Semion)

        A 1 Reply Last reply
        0
        • S Semion_N

          I don't really understand how to use that I write client.Credentials = and then what? for example if my user name is: abcd and password: efg ?

          SnaidiS(Semion)

          A Offline
          A Offline
          Abisodun
          wrote on last edited by
          #4

          http://msdn2.microsoft.com/en-us/library/system.net.credentialcache.aspx[^]

          S 1 Reply Last reply
          0
          • A Abisodun

            http://msdn2.microsoft.com/en-us/library/system.net.credentialcache.aspx[^]

            S Offline
            S Offline
            Semion_N
            wrote on last edited by
            #5

            string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message); I'v hilighted the changes, but the problem is still the same...

            SnaidiS(Semion)

            A 1 Reply Last reply
            0
            • S Semion_N

              I wrote this class: public class Send_Mail { public void send() { string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); //client.UseDefaultCredentials = true; client.Send(message); } } When I run it I have the following problem: An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http://www.mail.ru/pages/help/261.html for details. How do I authorize the account?

              SnaidiS(Semion)

              S Offline
              S Offline
              Semion_N
              wrote on last edited by
              #6

              Do you know any SMTP servers which doesn't require authorization?

              SnaidiS(Semion)

              D 1 Reply Last reply
              0
              • S Semion_N

                Do you know any SMTP servers which doesn't require authorization?

                SnaidiS(Semion)

                D Offline
                D Offline
                Dan Neely
                wrote on last edited by
                #7

                They've been all but gone from the net for years spammers would find and abuse them and the owner would have to implement authorization to get off blacklists.

                -- Rules of thumb should not be taken for the whole hand.

                S 1 Reply Last reply
                0
                • D Dan Neely

                  They've been all but gone from the net for years spammers would find and abuse them and the owner would have to implement authorization to get off blacklists.

                  -- Rules of thumb should not be taken for the whole hand.

                  S Offline
                  S Offline
                  Semion_N
                  wrote on last edited by
                  #8

                  OK, Please answer me to the question: string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message); I'v hilighted the changes, but the problem is still the same... -- modified at 15:12 Friday 19th January, 2007 SnaidiS(Semion)

                  SnaidiS(Semion)

                  R D 2 Replies Last reply
                  0
                  • S Semion_N

                    OK, Please answer me to the question: string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message); I'v hilighted the changes, but the problem is still the same... -- modified at 15:12 Friday 19th January, 2007 SnaidiS(Semion)

                    SnaidiS(Semion)

                    R Offline
                    R Offline
                    Rob Graham
                    wrote on last edited by
                    #9

                    Since UseDefaultCredentials defaults to true, perhaps you just need to explicitly set if false.

                    1 Reply Last reply
                    0
                    • S Semion_N

                      OK, Please answer me to the question: string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message); I'v hilighted the changes, but the problem is still the same... -- modified at 15:12 Friday 19th January, 2007 SnaidiS(Semion)

                      SnaidiS(Semion)

                      D Offline
                      D Offline
                      Dan Neely
                      wrote on last edited by
                      #10

                      Have you replaced "MyAcc" "MyPass" with the user name and password for your account on the email server? Your user name is probably "semionn.89", I can't tell you what your password is. :-D

                      Semion_N wrote:

                      cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));

                      -- Rules of thumb should not be taken for the whole hand.

                      1 Reply Last reply
                      0
                      • S Semion_N

                        string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message); I'v hilighted the changes, but the problem is still the same...

                        SnaidiS(Semion)

                        A Offline
                        A Offline
                        Abisodun
                        wrote on last edited by
                        #11

                        The following worked for my ISP. mail.bellsouth.net and 25 are the SMTP server name and outgoing port number respectively. private void btnTestEmail_Click(object sender, EventArgs e) { try { using (MailMessage message = new MailMessage(myEmail, myEmail, "subject1", "body1")) { SmtpClient mailClient = new SmtpClient("mail.bellsouth.net"); mailClient.UseDefaultCredentials = false; CredentialCache myCache = new CredentialCache(); myCache.Add("mail.bellsouth.net", 25, "Basic", new NetworkCredential(myUserName, myPassword)); mailClient.Credentials = myCache; mailClient.Send(message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } Good Luck.

                        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