【问题标题】:The outlook send dialog doesn't showOutlook 发送对话框不显示
【发布时间】:2016-03-19 18:53:33
【问题描述】:

我有一个 delphi 6 应用程序,它使用 mapi 打开 Outlook 发送对话框 带附件。 这适用于我的 PC 和其他客户端 PC。

我现在有 2 个未打开发送对话框的客户端。我什至没有得到 错误信息。客户拥有 W7 PC 和 Outlook 2013。 我试过 Fixmapi,但这没有帮助。

Outlook 工作正常,通过资源管理器发送对话框工作正常。

【问题讨论】:

  • 据我所知,Microsoft Office API 在 Office 2010 和更新版本中引入了一些相当大的变化,很容易破坏与仍然使用旧 API 调用的旧软件的兼容性。这可能也会影响 Outlook 2013 集成。因此,恐怕您将不得不研究文档以了解进行了哪些更改以及如何更新您的软件以使用最新版本的 Microsoft Office 和随附的程序。
  • 好的。银战士。你知道我在哪里可以找到文档吗?
  • 您使用的是什么 MAPI 包装器?
  • 我正在使用您的相同功能

标签: delphi outlook mapi


【解决方案1】:

我刚刚尝试了 MAPI,它适用于我,使用 Thunderbird 和 Outlook 2013。

我确实得到了一个 FIXMAPI 对话框,然后我得到了新的 Outlook 电子邮件窗口,和以前一样。

如果您只在特定机器上遇到问题,那么这不是编程问题,而是 Windows 问题。请务必使用控制面板查看您选择了哪些默认程序,包括哪些是默认 MAPI 邮件程序。

program MapiSample;

uses
  {Vcl.}Forms,
  Windows,
  SysUtils,
  {Vcl.}Dialogs,
  {WinApi.}MAPI;

type
  LPSTR = PAnsiChar;
  PSTR = PChar;

function SendMailMAPI(const Subject, Body, FileName, SenderName, SenderEMail,
                  RecepientName, RecepientEMail: AnsiString) : Integer;
var
  message: TMapiMessage;
  lpSender,
  lpRecepient: TMapiRecipDesc;
  FileAttach: TMapiFileDesc;
  SM: TFNMapiSendMail;
  MAPIModule: HModule;
begin
  FillChar(message, SizeOf(message), 0);
  with message do
  begin
    if (Subject<>'') then
    begin
      lpszSubject := LPSTR(Subject)
    end;
    if (Body<>'') then
    begin
      lpszNoteText := LPSTR(Body)
    end;
    if (SenderEMail<>'') then
    begin
      lpSender.ulRecipClass := MAPI_ORIG;
      if (SenderName='') then
      begin
        lpSender.lpszName := LPSTR(SenderEMail)
      end
      else
      begin
        lpSender.lpszName := LPSTR(SenderName)
      end;
      lpSender.lpszAddress := LPSTR('SMTP:'+SenderEMail);
      lpSender.ulReserved := 0;
      lpSender.ulEIDSize := 0;
      lpSender.lpEntryID := nil;
      lpOriginator := @lpSender;
    end;
    if (RecepientEMail<>'') then
    begin
      lpRecepient.ulRecipClass := MAPI_TO;
      if (RecepientName='') then
      begin
        lpRecepient.lpszName := LPSTR(RecepientEMail)
      end
      else
      begin
        lpRecepient.lpszName := LPSTR(RecepientName)
      end;
      lpRecepient.lpszAddress := LPSTR('SMTP:'+RecepientEMail);
      lpRecepient.ulReserved := 0;
      lpRecepient.ulEIDSize := 0;
      lpRecepient.lpEntryID := nil;
      nRecipCount := 1;
      lpRecips := @lpRecepient;
    end
    else
    begin
      lpRecips := nil
    end;
    if (FileName='') then
    begin
      nFileCount := 0;
      lpFiles := nil;
    end
    else
    begin
      FillChar(FileAttach, SizeOf(FileAttach), 0);
      FileAttach.nPosition := Cardinal($FFFFFFFF);
      FileAttach.lpszPathName := LPSTR(FileName);
      nFileCount := 1;
      lpFiles := @FileAttach;
    end;
  end;
  MAPIModule := LoadLibrary(PSTR(MAPIDLL));
  if MAPIModule=0 then
  begin
    Result := -1
  end
  else
  begin
    try
      @SM := GetProcAddress(MAPIModule, 'MAPISendMail');
      if @SM<>nil then
      begin
        Result := SM(0, Application.Handle, message, MAPI_DIALOG or
                     MAPI_LOGON_UI, 0);
      end
      else
      begin
        Result := 1
      end;

    finally
      FreeLibrary(MAPIModule);
    end;
  end;
  if Result<>0 then
  begin
    MessageDlg('Error sending mail ('+IntToStr(Result)+').', mtError, [mbOk],
               0)
  end;
end;

begin
    SendMailMapi('test','test','','My Name', 'sender@sender.com', 'Your Name', 'receiver@something.com');

end.

【讨论】:

  • 嗨 Warren,我正在使用相同的功能。
  • 如何查看默认的 mapi 电子邮件程序?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多