使用IMAP进行公司展望整合 [英] Company outlook integration using IMAP

查看:82
本文介绍了使用IMAP进行公司展望整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我有一个Outlook帐户,如公司名称abc,Outlook ID是sumit@abc.com,我想使用c#asp.net进行集成IMAP发送和接收邮件。



谢谢&此致,

Sumit Garg



我的尝试:



string Mailserver =imap.abc.com;

string MailServerPort =993;

string MailServerUsername =sumit@abc.com ;

字符串MailServerPwd =密码;

var client = new ImapX.ImapClient(imap.abc.com,993,true);

client.Connect();

client.Login(MailServerUsername,MailServerPwd);



ImapClient imap = new ImapClient(Mailserver,Convert.ToInt32(MailServerPort),true);

imap.IsDebug = true;

ImapClient imapClient;

int count = client.Folders.Inbox.Messages.Count();





它显示零计数。

hello,

I have an Outlook account like company name abc and Outlook id is sumit@abc.com and i want to integration using c# asp.net for send and receive mail by IMAP.

Thanks & Regards,
Sumit Garg

What I have tried:

string Mailserver = "imap.abc.com";
string MailServerPort = "993";
string MailServerUsername = "sumit@abc.com";
string MailServerPwd = "Password";
var client = new ImapX.ImapClient("imap.abc.com", 993, true);
client.Connect();
client.Login(MailServerUsername, MailServerPwd);

ImapClient imap = new ImapClient(Mailserver, Convert.ToInt32(MailServerPort), true);
imap.IsDebug = true;
ImapClient imapClient;
int count = client.Folders.Inbox.Messages.Count();


its showing zero count.

推荐答案

我会尝试在DEBUG中使用一些IF来运行它...那么& TRY ... CATCH块以及一些断点,以查看您实际关注的路径。
I would try running this in DEBUG with some IF...THEN & TRY...CATCH blocks as well as some Breakpoints to see what path you are actually following.
string Mailserver = "imap.abc.com";
int MailServerPort = 993;          // why set this as a string to convert back later?
string MailServerUsername = "sumit@abc.com";
string MailServerPwd = "Password";

try {
  var client = new ImapX.ImapClient("imap.abc.com", 993, true);

  if (!client.Connect()) {
    // Connection Failed ==> TODO: Figure out why
  } else {
    // We connected.... Now lets try to login

    if (!client.Login(MailServerUsername, MailServerPwd)) {
      // Login failed ==> TODO: Figure out why
    } else {
      // continue with your code, using similar techniques
    }
  }
} catch (Exception ex) {
  // TODO:  Analyze EX and work from there
}



文档

https://imapx.org/docs/wikipage%20(1).html [ ^ ]


这篇关于使用IMAP进行公司展望整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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