如何使用C#阅读gmail收件箱? [英] How to read gmail inbox using C#?

查看:117
本文介绍了如何使用C#阅读gmail收件箱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用c#阅读gmail收件箱。

我使用pop.gmail.com尝试了一些代码,但收到了创建连接的错误。



请帮我解决这个问题。



我尝试了什么:



I am trying to read gmail inbox using c#.
I have tried some codes using pop.gmail.com, but getting error which creating connection.

Please help me with this issue.

What I have tried:

Pop3Client pop3Client;

            if (Session["Pop3Client"] == null)
            {
                pop3Client = new Pop3Client();
                pop3Client.Connect("pop.gmail.com", 465, true);
                pop3Client.Authenticate("youremail@gmail.com", "password", AuthenticationMethod.TryBoth);
                Session["Pop3Client"] = pop3Client;
            }
            else
            {
                pop3Client = (Pop3Client)Session["Pop3Client"];
        }

推荐答案

您使用的是错误的端口。我用google搜索c#read gamil inbox pop3,这里列出了正确的设置





从C#中的Gmail帐户下载/检索电子邮件 [ ^ ]



然后我用google搜索c#read gmail收件箱pop3client并找到了这个



在ASP.NET中读取Gmail收件箱消息 [ ^ ]
You're using the wrong port. I googled "c# read gamil inbox pop3" and the proper settings are listed here


Download/Retrieve Email from Gmail account in C#[^]

I then googled "c# read gmail inbox pop3client" and found this

Read Gmail Inbox Message in ASP.NET[^]


这篇关于如何使用C#阅读gmail收件箱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆