将邮件消息下载为 MSG 文件时发生 WinSock 错误

发布于 2024-09-28 14:17:14 字数 2193 浏览 7 评论 0原文

我的环境是

服务器计算机:DocuShare Server 6

客户端计算机:Windows XP,其中安装了 DocuShare 客户端 6、DocuShare Outlook 客户端 3、MS Outlook 2007 和我们的 C# 应用程序。

我们有一个 C# 应用程序,用于使用 DocuShare API 从 DocuShare 服务器下载邮件消息。

该应用程序成功地将 docushare 邮件消息下载为 MSG 文件。但是,当邮件消息包含长名称附件时(在我的例子中,附件文件名是 “New Tzunami Outlook Attachment Extractor User Guide 20100902.docx”),应用程序在下载时抛出 Windows Socket 错误。如果附件文件名很短,则邮件消息下载成功。

以下是代码:

private void btnDownloadMails_Click(object sender, EventArgs e)
{
    MailArgument mailArg = new MailArgument();
    mailArg.server = textServer.Text;
    mailArg.user = textUser.Text;
    mailArg.password = textPwd.Text;
    DownloadMailAsMsg(mailArg);
}

void DownloadMailAsMsg(object s)
{
    MailArgument mailArg = s as MailArgument;
    long status = 0;

    DSServerMap.Server dsserver = new DSServerMap.Server();

    if (!SelectMappedServer(ref dsserver, mailArg.server))
        return;             

    dsserver.DocuShareAddress = mailArg.server;
    dsserver.UserName = mailArg.user;
    dsserver.Password = mailArg.password;
    dsserver.Domain = "DocuShare";
    status = dsserver.Logon();                        

    if (status == 0)
    {
        IItemObj objParentItem;
        string[] emailHan = { "MailMessage-2919", "MailMessage-2924", "MailMessage-2925", "MailMessage-2926", "MailMessage-2926", "MailMessage-15", "MailMessage-30", "MailMessage-31" };
        foreach (string handnum in emailHan)
        {
            objParentItem = (IItemObj)dsserver.CreateObject(handnum);
            DSGATEWAYLib.IGatewayHandler gateway = (DSGATEWAYLib.IGatewayHandler)dsserver.Open();                   
            objParentItem.AttachGateway(gateway, true);
            objParentItem.Name = @"D:\emtest\" + handnum + ".msg";                     
            int flag = objParentItem.DSDownload(0);
        }
    }
}

我卡住的地方是这一行: int flag = objParentItem.DSDownload(0);下载包含名为“New Tzunami Outlook Attachment Extractor User Guide 20100902.docx”的附件文件的电子邮件时。 为了进行检查,我们将附件文件名修剪为“ANew Tzunami OutAttachmen 01.docx”,但仍然遇到相同的错误。

代码 objParentItem.DSDownload(0) 返回 -300 值,同时弹出 DocuShare 错误对话框,并显示以下消息

“Winsock error 123”

My environments are

Server Machine: DocuShare Server 6

Client Machine: Windows XP where DocuShare client 6, DocuShare outlook client 3, MS outlook 2007 and our C# application are installed.

We have a C# application to download mail message from DocuShare server using DocuShare API.

The application successfully downloads docushare mail messages as MSG file. But when the mail message has attachment with long name (in my case the attachment file name is
"New Tzunami Outlook Attachment Extractor User Guide 20100902.docx"), the application throws Windows Socket error while downloading. If the attachment file name is short, mail messages are downloaded successfully.

Here are the codes:

private void btnDownloadMails_Click(object sender, EventArgs e)
{
    MailArgument mailArg = new MailArgument();
    mailArg.server = textServer.Text;
    mailArg.user = textUser.Text;
    mailArg.password = textPwd.Text;
    DownloadMailAsMsg(mailArg);
}

void DownloadMailAsMsg(object s)
{
    MailArgument mailArg = s as MailArgument;
    long status = 0;

    DSServerMap.Server dsserver = new DSServerMap.Server();

    if (!SelectMappedServer(ref dsserver, mailArg.server))
        return;             

    dsserver.DocuShareAddress = mailArg.server;
    dsserver.UserName = mailArg.user;
    dsserver.Password = mailArg.password;
    dsserver.Domain = "DocuShare";
    status = dsserver.Logon();                        

    if (status == 0)
    {
        IItemObj objParentItem;
        string[] emailHan = { "MailMessage-2919", "MailMessage-2924", "MailMessage-2925", "MailMessage-2926", "MailMessage-2926", "MailMessage-15", "MailMessage-30", "MailMessage-31" };
        foreach (string handnum in emailHan)
        {
            objParentItem = (IItemObj)dsserver.CreateObject(handnum);
            DSGATEWAYLib.IGatewayHandler gateway = (DSGATEWAYLib.IGatewayHandler)dsserver.Open();                   
            objParentItem.AttachGateway(gateway, true);
            objParentItem.Name = @"D:\emtest\" + handnum + ".msg";                     
            int flag = objParentItem.DSDownload(0);
        }
    }
}

Where I stuck is at the line: int flag = objParentItem.DSDownload(0); while downloading email which have attachment file named "New Tzunami Outlook Attachment Extractor User Guide 20100902.docx".
For checking, we trimmed the attachment file name to "ANew Tzunami OutAttachmen 01.docx" but we still got the same error.

The code objParentItem.DSDownload(0) return -300 value and at the same time DocuShare error dialog box pops up with following message

"Winsock error 123"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

弥繁 2024-10-05 14:17:14

当使用 DsAxess 控制台下载相同的邮件消息时,我们得到了相同的 WinSock 错误,因此无能为力;)。

我们使用 WorldClient 邮件应用程序来发送电子邮件。我们使用 WorldCLient 发送了附件名为“ANew Tzunami OutAttachmen 01.docx”的电子邮件,但下载失败。为了测试,我们使用另一个应用程序发送带有相同附件的电子邮件。这次我们使用 MS Word 发送带有相同附件的电子邮件,并且我们也使用 C# 应用程序和 DsAxess 控制台成功下载了电子邮件。

如果您对此有任何疑问,请与我们分享。

谢谢。
普拉卡什

When DsAxess console is used to download the same mail message, we got the same WinSock error, so nothing can be done;).

We used WorldClient mail application for sending emails. We sent email with the attachment having "ANew Tzunami OutAttachmen 01.docx" file name using WorldCLient, which we failed to download. For the sake of tesing we used another application to send the email with the same attachment. This time we used MS word to send email with the same attachment and we succeeded downloading email using C# app and DsAxess console as well.

If you have anything about this, please share with us.

thank you.
Prakash

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文