我想使用lotusscript代理或Java代理或Javascript语言将exchnage服务器上的邮件(主题行和正文内容)导出到Excel。我该如何实现这一目标?任何想法,建议或示例代码都是可观的。
做了reasearch后发现代码从POP3服务器下载邮件。我使用下面的代码,但卡在 var oServer = new ActiveXObject(“EAGetMailObj.MailServer”); 错误 - “自动化服务器无法创建对象”。然后我将主机URL放在可信站点并启用IE的活动x控件设置,但随后也得到相同的错误。任何想法,为什么?
以下代码演示了如何从POP3邮件帐户接收电子邮件。此示例从POP3服务器下载电子邮件,并在检索到电子邮件后删除电子邮件。
代码:
MailServerPop3 = 0;
MailServerImap4 = 1;
try
{
var oServer = new ActiveXObject("EAGetMailObj.MailServer");
// please change the server, user, password to yours
oServer.Server = "pop3.adminsystem.com"
oServer.Protocol = MailServerPop3;
oServer.User = "testx";
oServer.Password = "testpassword";
// If your server requires SSL connection,
// Please add the following codes.
oServer.SSLConnection = true;
oServer.Port = 995;
var oClient = new ActiveXObject("EAGetMailObj.MailClient");
oClient.LicenseCode = "TryIt";
// Connect POP3 server.
oClient.Connect(oServer);
var infos = new VBArray(oClient.GetMailInfos()).toArray();
for (var i = 0; i < infos.length; i++) {
var info = infos[i];
// Receive email from POP3 server
var oMail = oClient.GetMail(info);
// Save email to local disk
oMail.SaveAs("d:\\" + i + "_test.eml", true);
// Mark email as deleted on server.
oClient.Delete(info);
}
// Quit and pure emails marked as deleted from POP3 server.
oClient.Quit
}
catch( err )
{
WScript.Echo( err.description );
}
答案 0 :(得分:0)