Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8257761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:18:20+00:00 2026-06-08T02:18:20+00:00

I am trying to connect gmail using C# pop3 but it give an error

  • 0

I am trying to connect gmail using C# pop3 but it give an error that :
The remote certificate is invalid according to the validation procedure.

I use the given below code to connect

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml;


    public void Connect()
            {
                if (Client == null)
                    Client = new TcpClient();
                if (!Client.Connected)
                    Client.Connect(Host, Port);
                if (IsSecure)
                {
                    SslStream secureStream = new SslStream(Client.GetStream());
                    secureStream.AuthenticateAsClient(Host);
                    ClientStream = secureStream;
                    secureStream = null;
                }
                else
                    ClientStream = Client.GetStream();
                Writer = new StreamWriter(ClientStream);
                Reader = new StreamReader(ClientStream);
                ReadLine();
                Login();
            }

here my host is “pop.gmail.com” and port is “995”

secureStream.AuthenticateAsClient(Host); at this line the error has been occurred

“The remote certificate is invalid according to the validation procedure.”

Please suggest me something to solve this issue..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:18:23+00:00Added an answer on June 8, 2026 at 2:18 am

    As a workaround, you can switch off certificate validation

    put this code somewere before smtpclient.Send():

    ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to connect to my gmail account via smtp using port 465
I am trying to connect to my gmail account using com.sun.mail ..... Mail api.
I am trying to send email through gmail using PHPMailer_V5.1. Getting the following error,
I am trying to import the contact list from gmail using libgmailer.php but I
I am trying to connect to gmail via its IMAP API . I am
When I am trying to connect to my SVN repository on some remote server
I am trying to connect to a MySQL Server using JDBC tool in java
I'm trying to access Gmail by using three-legged Oauth PHP code provided by Google
I am trying to use gmail's SMTP server smtp.gmail.com to send mails using C
Hey guys, I am trying to send email using my gmail account, and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.