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

问题描述

你好,



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



谢谢&此致,

Sumit Garg



我的尝试:



string Mailserver =imap.abc.com;

string MailServerPort =993;

string MailServerUsername [email protected] ;

字符串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 [email protected] 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 = "[email protected]";
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.

推荐答案

string Mailserver = "imap.abc.com";
int MailServerPort = 993;          // why set this as a string to convert back later?
string MailServerUsername = "[email protected]";
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
}



文档

[]


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

09-27 12:48