使用c#和asp.net访问邮件收件箱 [英] access mail inbox using c# and asp.net

查看:101
本文介绍了使用c#和asp.net访问邮件收件箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过提供帐户的用户名和密码来访问我的应用程序中的gmail收件箱

i want to access gmail inbox into my application by providing the username and password of the account

推荐答案

您应该尝试过专用的GMAIL官方链接 [类似的讨论1 [类似的讨论2 [
You should have tried this[^] and got these and many more:
Offiical GMAIL link for very purpose[^]
Similar discussion 1[^]
Similar diiscussion 2[^]


使用Outlook = Microsoft.Office.Interop.Outlook; //您需要添加Microsoft Office 11.0对象库才能使用它.我的版本是11,您可能有较旧或更高的版本.

Outlook.Application Outlook =新的Outlook.ApplicationClass();
Outlook.NameSpace ns = Outlook.GetNamespace("Mapi");
对象_missing = Type.Missing;
ns.Logon(_missing,_missing,false,true);

Outlook.MAPIFolder收件箱= ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

int未读= inbox.UnReadItemCount;
foreach(inbox.Items中的Outlook.MailItem邮件)
{
字符串s = mail.Subject;
}
using Outlook = Microsoft.Office.Interop.Outlook; //you need to add the Microsoft Office 11.0 Object Library to use this. mine is version 11 you might have an older or later version.

Outlook.Application outlook = new Outlook.ApplicationClass();
Outlook.NameSpace ns = outlook.GetNamespace("Mapi");
object _missing = Type.Missing;
ns.Logon(_missing, _missing, false, true);

Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

int unread = inbox.UnReadItemCount;
foreach (Outlook.MailItem mail in inbox.Items)
{
string s = mail.Subject;
}


这篇关于使用c#和asp.net访问邮件收件箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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