C++/CLIでNotes C APIを使用する設定

Notes C API を C++/CLI から使う方法を書いたものがインターネット上に見当たらなかったので書いてみました。

以下の設定はVisual Studio 2005 Standard Edition (英語バージョン)を使っています。

  1. New Projectからプロジェクトを作成したあと、[Project] – [Properties]からプロパティを開きます。
  2. 左のナビゲーションから [Configuration Properties] – [General] を開く。Dynamic Library(.dll) Common Language Runtime Support (/clr) を設定
    Configuration Properties - General

    Configuration Properties - General

  3. プロパティから [C/C++] – [General]を開きます。[Additional Include Directories]に Notes C API include folderを追加。

    C/C++ - General

    C/C++ - General

  4. [C/C++] – [Peprocessor]を開きます。[Preprocessor Definitions]に W32;WIN32 を追加。

    C/C++ - Preprocessor

    C/C++ - Preprocessor

  5. [C/C++] – [Code Generation]を開きます。[Runtime Library]からMulti-threaded DLL (/MD)を選択。

    C/C++ - Code Generation

    C/C++ - Code Generation

  6. [Linker] – [General]を開きます。[Additional Include Directories]にC Notes API Libraryを追加。

    Linker - General

    Linker - General

  7. [Linker] – [Input]を開きます。[Additional Dependencies]にnotes.lib を追加。
    Linker - Input

    Linker - Input

    必要であればnotes.libを相対パスで指定します。(例)notesapilibmswin32notes.lib

以上です。

Notes C APIを快適なC++/CLIのプログラミングでラッピングしてしまうことで、他のプログラム(C#やJava)とのインテグレーションが容易になると思います。

How to configure Notes C API with C++/CLI on Visual Studio

I wrote this article since there are little information about how to use Notes C API on C++/CLI with CLR.

Below is the settings to configure the DLL project with using Notes C API on C++/CLI. I am using Visual Studio 2005 Standard Edition.

  1. After creating New Project, Go to [Project] – [Properties]
  2. Go to [Configuration Properties] – [General] from left Navigation.
    Configure Dynamic Library(.dll) and Common Language Runtime Support (/clr)

    Configuration Properties - General

    Configuration Properties - General

  3. Go to [C/C++] – [General]
    Add Notes C API include folder into [Additional Include Directories]

    C/C++ - General

    C/C++ - General

  4. Go to [C/C++] – [Peprocessor]
    Add W32;WIN32 into [Preprocessor Definitions]

    C/C++ - Preprocessor

    C/C++ - Preprocessor

  5. Go to [C/C++] – [Code Generation]
    Configure Multi-threaded DLL (/MD) into [Runtime Library]

    C/C++ - Code Generation

    C/C++ - Code Generation

  6. Go to [Linker] – [General]
    Add C Notes API Library into [Additional Include Directories]

    Linker - General

    Linker - General

  7. Go to [Linker] – [Input]
    Add notes.lib into [Additional Dependencies]

    Linker - Input

    Linker - Input

    Point the relative path if you need (i.e) notesapilibmswin32notes.lib

That’s all!
Enjoy C++/CLI programming with Notes C API!

Tagged with: , ,

Mail rejected for policy reasons because domain not found in DNS

At one of our client sites, we experienced a strange behaviour where incoming emails were being rejected for policy reasons and outgoing emails were not being delivered.

04/15/2009 01:34:40 PM  Router: Failed to connect to SMTP host HOST.SOMEDOMAIN.COM because The server is not responding. The server may be down or you may be experiencing network problems. Contact your system administrator if this problem persists.

Or something like this : Mail from user@somedomain.com rejected for policy reasons. Domain not found in DNS.

The quick solution was to have “tell router update config” command run every 30 minutes (less is better) so that domino can flush its DNS record that have been cached. Strange behaviour as we have to do it often.

Here is the screen shot

tellrouterupdateconfig1

tellrouterupdateconfig2

**Update 4/20/2009**

We requested a PMR from IBM and it may turn out that there could be a problem in the Domino code itself. The support engineer has escalated this issue for a possible hotfix. We experienced this issue using Domino 8.0.2 FP1 plus another server that runs on Linux with Domino 8.5 has also had a similar problem, but mails for some reason get delivered after a couple of seconds on the 8.5 server.

IBM has provided us with a hotfix to solve the problem where Domino server caches an A record until 2043 when an MX record is not found during DNS query or when there is an error. In case you are interested, the hotfix number is 287 (02FP1HF287) but I believe you have to get it by calling in to IBM support. Here is a quote from the support engineer :

It sets a default TTL for DNS that router uses in its cache to 30 minutes when an error occurs or when a non-MX record is returned.

This default is adjustable by the INI RouterDNSErrorTTL. The INI expects seconds so a value of 3600 would be 1 hour. I would not recommend adjusting the TTL unless needed so do not use the INI unless there is a reason.

To get more detail on your log and to see whether it caches certain A record until year 2043, increase the debug output level by entering the following into the Domino console:

start consolelog
set config debug_threadid=1 (0 to disable)
set config debugrouter=3 (0 to disable)
set config log_mailrouting=40 (20 to disable)
set config smtpclientdebug=3 (0 to disable)
restart task router

Tagged with: , , , , ,
Top