The SMTP server requires a secure connection or the client was not authenticated. The

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srimathiparthasarathy
    New Member
    • Feb 2010
    • 18

    The SMTP server requires a secure connection or the client was not authenticated. The

    this error is occuring while am submitting form in asp.net,code behind C#.
    what is the meaning of this error,
    what is my fault
    can any one reply???
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Are you passing proper parameters, i.e. domain name, username, password, smtp port number and so on?

    Why not post your code segment here, it will be much easier to debug your code. Take care :)

    Comment

    • srimathiparthasarathy
      New Member
      • Feb 2010
      • 18

      #3
      This my code.
      what is wrong here???????????


      private void EmailAccountInf ormation()
      {
      try
      {
      int port = 587;//use 465 also
      string userName = "zionrealtors@g mail.com";
      string password = "zion*123#" ;

      MailMessage message = new MailMessage();
      message.From = new MailAddress("ad min@zionrealtor s.com");
      string MailId = txtMemEmailId.T ext;
      ViewState["email"] = MailId;
      message.To.Add( new MailAddress(Mai lId.ToString()) );
      //message.To.Add( "immanuelseeni@ yahoo.com,mohid een84@yahoo.co. in");

      message.Subject = "Account Info";
      message.IsBodyH tml = true;
      string msgbody = "Thanks for joining ZionRealtors,<b r><br>Please memory your registration infos:<br><br>< font color=blue size=+1>EmailId : " + MailId + "<br>Passwo rd: " + txtMemPassword. Text + "</font>";
      message.Body = msgbody;

      SmtpClient smtp = new SmtpClient("smt p.gmail.com", port);
      smtp.Credential s = new System.Net.Netw orkCredential(u serName, password);
      smtp.EnableSsl = true;
      smtp.Send(messa ge);

      Comment

      • srimathiparthasarathy
        New Member
        • Feb 2010
        • 18

        #4
        private void EmailAccountInf ormation()
        {
        try
        {
        int port = 587;//use 465 also
        string userName = "zionrealtors@g mail.com";
        string password = "zion*123#" ;

        MailMessage message = new MailMessage();
        message.From = new MailAddress("ad min@zionrealtor s.com");
        string MailId = txtMemEmailId.T ext;
        ViewState["email"] = MailId;
        message.To.Add( new MailAddress(Mai lId.ToString()) );
        //message.To.Add( "immanuelseeni@ yahoo.com,mohid een84@yahoo.co. in");

        message.Subject = "Account Info";
        message.IsBodyH tml = true;
        string msgbody = "Thanks for joining ZionRealtors,<b r><br>Please memory your registration infos:<br><br>< font color=blue size=+1>EmailId : " + MailId + "<br>Passwo rd: " + txtMemPassword. Text + "</font>";
        message.Body = msgbody;

        SmtpClient smtp = new SmtpClient("smt p.gmail.com", port);
        smtp.Credential s = new System.Net.Netw orkCredential(u serName, password);
        smtp.EnableSsl = true;
        smtp.Send(messa ge);

        Comment

        • sashi
          Recognized Expert Top Contributor
          • Jun 2006
          • 1749

          #5
          Try out the below modified code segment. Good luck & Take care :)

          Code:
            // Begin modification
            SmtpClient smtp = new SmtpClient();
            Smtp.Host = "smtp.gmail.com";
            Smtp.Port = port;
            Smtp.Timeout = 50000;
            Smtp.EnableSsl = True;
            smtp.Credentials = new System.Net.NetworkCredential(userName, password);
            // End modification
            smtp.Send(message);

          Comment

          • srimathiparthasarathy
            New Member
            • Feb 2010
            • 18

            #6
            ok am trying but there nothing difference in your code and what i have posted before.
            except timeout....

            thank u anyway

            Comment

            • sashi
              Recognized Expert Top Contributor
              • Jun 2006
              • 1749

              #7
              Only that you see? What about the rest of the changes?

              Comment

              • srimathiparthasarathy
                New Member
                • Feb 2010
                • 18

                #8
                i could not understand what hapenin while iam debugging...... ............
                still it is displaying same error...

                Comment

                • srimathiparthasarathy
                  New Member
                  • Feb 2010
                  • 18

                  #9
                  ok am checking.
                  am trying.cool

                  Comment

                  • sashi
                    Recognized Expert Top Contributor
                    • Jun 2006
                    • 1749

                    #10
                    i could not understand what hapenin while iam debugging
                    Is this your code? Or perhaps you got it from the web?

                    Comment

                    • srimathiparthasarathy
                      New Member
                      • Feb 2010
                      • 18

                      #11
                      no this not my code.my job is to correct the code.but i couldnot understand what is going.am just blinking...

                      Comment

                      • srimathiparthasarathy
                        New Member
                        • Feb 2010
                        • 18

                        #12
                        thank you sashi for your patience

                        Comment

                        • sashi
                          Recognized Expert Top Contributor
                          • Jun 2006
                          • 1749

                          #13
                          no this not my code.my job is to correct the code
                          I tot so. How would you debug code without understanding it in the 1st place? You need to understand the code in order to be able to correct it. When you expect someone else to debug it there is a minimum priced applied, patience is the price.

                          Good luck :)

                          Comment

                          • srimathiparthasarathy
                            New Member
                            • Feb 2010
                            • 18

                            #14
                            hi sashi

                            i got it.

                            i have passes invalid password.

                            thank u for ur help

                            Comment

                            Working...