You cannot configure the TLS settings for SMTP communication in Microsoft Dynamics NAV 2009

This article applies to Microsoft Dynamics NAV for all countries and all language locales.

Symptoms

You cannot configure the TLS settings for SMTP communication in Microsoft Dynamics NAV 2009.
This problem occurs in the following products:
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)

Resolution

Hotfix information

A supported hotfix is available from Microsoft. There is a "Hotfix download available" section at the top of this Knowledge Base article. If you are encountering an issue downloading, installing this hotfix, or have other technical support questions, contact your partner or, if enrolled in a support plan directly with Microsoft, you can contact technical support for Microsoft Dynamics and create a new support request. To do this, visit the following Microsoft website: You can also contact technical support for Microsoft Dynamics by phone using these links for country specific phone numbers. To do this, visit one of the following Microsoft websites:

PartnersCustomersIn special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to any additional support questions and issues that do not qualify for the specific update in question.


After you apply this hotfix, the exception does not cause an unexpected crash. In this situation, a handled error message is written to the Application log instead.

How to obtain the Microsoft Dynamics NAV hotfix or update files

After you request a Microsoft Dynamics NAV hotfix, a hyperlink will be sent to you in an e-mail.


The e-mail will contain a hyperlink and a password. You can use the hyperlink to download the Microsoft Dynamics NAV hotfix or the update files. When you click the hyperlink, the File Download – Security Warning dialog box opens. Then, you are prompted to run, to save, or to cancel the download.


If you click Run, the files start the download and the extraction process. You must specify a folder for the new files, and then provide the password.


If you click Save, you must specify a path for saving the compressed file. When you open the file that you saved, you are prompted to specify a path for the files. Then, you must provide the password provided in the e-mail.


If you click Cancel, the download process stops.


How to install a Microsoft Dynamics NAV hotfix or an update file

The Microsoft Dynamics NAV platform hotfixes and updates are made available as single files. To install a Microsoft Dynamics NAV hotfix or an update, you must replace the existing Microsoft Dynamics NAV installation files with the hotfix or the update files.

File Information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
File nameFile versionFile sizeDateTimePlatform
Microsoft.navision.mail.dll7.3.0.026,48020-Jan-201116:31x86
Microsoft.navision.mail.tlbNot applicable3,64820-Jan-201109:42Not applicable
Note This hotfix works for signed certificates. If the certificate is self-signed, you must manually sign the certifcate and install this hotfix as trusted.

To do this, follow these steps:
  1. Copy the files that you extracted from the hotfix files to the following folder:
    %ProgramFiles%\Common Files\Microsoft Dynamics NAV\Mail
  2. Register the new Microsoft.Navision.Mail.dll assembly through the Assembly Registration tool (Regasm.exe) by using the following command:
    regasm /codebase /tlb:Microsoft.Navision.Mail.tlb Microsoft.Navision.Mail.dll

    For example, you can make sure that the Regasm.exe file is in the Mail folder mentioned in step 1, open the command prompt, change the directory to "C:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Mail", and then run the following command to register the Microsoft.Navision.Mail.dll assembly:
    RegAsm.exe /codebase /tlb:Microsoft.Navision.Mail.tlb Microsoft.Navision.Mail.dll
  3. Change the code in the SMTP Mail Setup table (409) as follows:
    Existing code
    ...
    FIELDS
    {
    { 1 ; ;Primary Key ;Code10 ;CaptionML=ENU=Primary Key }
    { 2 ; ;SMTP Server ;Text250 ;CaptionML=ENU=SMTP Server }
    { 3 ; ;Authentication ;Option ;OnValidate=BEGIN
    IF Authentication <> Authentication::Basic THEN BEGIN
    "User ID" := '';
    Password := '';
    END;
    END;

    CaptionML=ENU=Authentication;
    OptionCaptionML=ENU=Anonymous,NTLM,Basic;
    OptionString=Anonymous,NTLM,Basic }
    { 4 ; ;User ID ;Text30 ;OnValidate=BEGIN
    TESTFIELD(Authentication,Authentication::Basic);
    END;

    CaptionML=ENU=User ID }
    { 5 ; ;Password ;Text30 ;OnValidate=BEGIN
    TESTFIELD(Authentication,Authentication::Basic);
    END;

    CaptionML=ENU=Password }
    }
    ...
    Replacement code
    ...
    FIELDS
    {
    { 1 ; ;Primary Key ;Code10 ;CaptionML=ENU=Primary Key }
    { 2 ; ;SMTP Server ;Text250 ;CaptionML=ENU=SMTP Server }
    { 3 ; ;Authentication ;Option ;OnValidate=BEGIN
    IF Authentication <> Authentication::Basic THEN BEGIN
    "User ID" := '';
    Password := '';
    END;
    END;

    CaptionML=ENU=Authentication;
    OptionCaptionML=ENU=Anonymous,NTLM,Basic;
    OptionString=Anonymous,NTLM,Basic }
    { 4 ; ;User ID ;Text30 ;OnValidate=BEGIN
    TESTFIELD(Authentication,Authentication::Basic);
    END;

    CaptionML=ENU=User ID }
    { 5 ; ;Password ;Text30 ;OnValidate=BEGIN
    TESTFIELD(Authentication,Authentication::Basic);
    END;

    CaptionML=ENU=Password }

    // Add the following lines.
    { 50000; ;SMTP Server Port ;Integer ;InitValue=25 }
    { 50001; ;Secure Connection ;Boolean ;InitValue=No }
    // End of the lines.

    }
    ...
  4. Change the code in the SMTP Mail Setup form (409) as follows:
    Existing code 1
    ...
    OnOpenForm=BEGIN
    RESET;
    IF NOT GET THEN
    INSERT;
    CurrForm."User ID".EDITABLE := Authentication = Authentication::Basic;
    CurrForm.Password.EDITABLE := Authentication = Authentication::Basic;
    END;
    ...
    Replacement code 1
    ...
    OnOpenForm=BEGIN
    RESET;
    IF NOT GET THEN
    BEGIN

    // Add the following line.
    INIT;

    INSERT;

    // Add the following line.
    END;

    CurrForm."User ID".EDITABLE := Authentication = Authentication::Basic;
    CurrForm.Password.EDITABLE := Authentication = Authentication::Basic;
    END;
    ...
    Existing code 2
    ...
    CONTROLS
    {
    { 1 ;TabControl ;220 ;220 ;9350 ;5280 ;HorzGlue=Both;
    VertGlue=Both;
    PageNamesML=ENU=General }
    { 2 ;TextBox ;3850 ;990 ;5500 ;440 ;ParentControl=1;
    InPage=0;
    SourceExpr="SMTP Server" }
    { 3 ;Label ;440 ;990 ;3300 ;440 ;ParentControl=2 }
    { 6 ;TextBox ;3850 ;2090 ;5500 ;440 ;ParentControl=1;
    InPage=0;
    SourceExpr="User ID" }
    { 7 ;Label ;440 ;2090 ;3300 ;440 ;ParentControl=6 }
    { 8 ;TextBox ;3850 ;2640 ;5500 ;440 ;ParentControl=1;
    InPage=0;
    PasswordText=Yes;
    SourceExpr=Password }
    { 9 ;Label ;440 ;2640 ;3300 ;440 ;ParentControl=8 }
    { 4 ;TextBox ;3850 ;1540 ;2750 ;440 ;ParentControl=1;
    InPage=0;
    SourceExpr=Authentication;
    OnAfterValidate=BEGIN
    CurrForm."User ID".EDITABLE := Authentication = Authentication::Basic;
    CurrForm.Password.EDITABLE := Authentication = Authentication::Basic;
    END;
    }
    { 5 ;Label ;440 ;1540 ;3300 ;440 ;ParentControl=4 }
    { 10 ;CommandButton;7370 ;5720 ;2200 ;550 ;HorzGlue=Right;
    VertGlue=Bottom;
    PushAction=FormHelp }
    }
    ...
    Replacement code 2
    ...
    CONTROLS
    {
    { 1 ;TabControl ;220 ;220 ;9350 ;5280 ;HorzGlue=Both;
    VertGlue=Both;
    PageNamesML=ENU=General }
    { 2 ;TextBox ;3850 ;990 ;5500 ;440 ;ParentControl=1;
    InPage=0;
    SourceExpr="SMTP Server" }
    { 3 ;Label ;440 ;990 ;3300 ;440 ;ParentControl=2 }
    { 6 ;TextBox ;3850 ;2640 ;5500 ;440 ;ParentControl=1;
    InPage=0;
    SourceExpr="User ID" }
    { 7 ;Label ;440 ;2640 ;3300 ;440 ;ParentControl=6 }
    { 8 ;TextBox ;3850 ;3190 ;5500 ;440 ;ParentControl=1;
    InPage=0;
    PasswordText=Yes;
    SourceExpr=Password }
    { 9 ;Label ;440 ;3190 ;3300 ;440 ;ParentControl=8 }
    { 4 ;TextBox ;3850 ;1540 ;2750 ;440 ;ParentControl=1;
    InPage=0;
    SourceExpr=Authentication;
    OnAfterValidate=BEGIN
    CurrForm."User ID".EDITABLE := Authentication = Authentication::Basic;
    CurrForm.Password.EDITABLE := Authentication = Authentication::Basic;
    END;
    }
    { 5 ;Label ;440 ;1540 ;3300 ;440 ;ParentControl=4 }

    // Add the following lines.
    { 14 ;TextBox ;3850 ;2090 ;5500 ;440 ;Name=<SMTP Server Port>;
    ParentControl=1;
    InPage=0;
    DecimalPlaces=0:0;
    NotBlank=Yes;
    Numeric=Yes;
    SourceExpr="SMTP Server Port";
    MinValue=1 }
    { 15 ;Label ;440 ;2090 ;3300 ;440 ;ParentControl=14;
    CaptionML=ENU=SMTP Server Port }
    { 12 ;CheckBox ;3850 ;3740 ;440 ;440 ;ParentControl=1;
    InPage=0;
    ShowCaption=No;
    SourceExpr="Secure Connection" }
    { 11 ;Label ;440 ;3740 ;3300 ;440 ;ParentControl=12 }
    // End of the lines.

    { 10 ;CommandButton;7370 ;5720 ;2200 ;550 ;HorzGlue=Right;
    VertGlue=Bottom;
    PushAction=FormHelp }
    }
    ...
  5. Change the Mail variable in the SMTP Mail codeunit (400) as follows:
    Existing value
    Mail@1000 : Automation "{68AEAA7B-9523-3511-AF5F-F2381D2C6F04} 1.0:{F9DAE2A4-D2F8-37C3-86D5-E4FFE166D860}:'Microsoft Navision Mail'.SmtpMessage";
    Replacement value
    Mail@1000 : Automation "{68AEAA7B-9523-3511-AF5F-F2381D2C6F04} 7.3:{F9DAE2A4-D2F8-37C3-86D5-E4FFE166D860}:'Microsoft Navision Mail'.SmtpMessage";
  6. Change the code in the SMTP Mail codeunit (400) as follows:
    Existing code
    ...
    BEGIN
    WITH SMTPMailSetup DO
    Result :=
    Mail.Send(

    // Delete the following line.
    "SMTP Server",Authentication <> SMTPMailSetup.Authentication::Anonymous,"User ID", Password);

    Mail.Dispose;
    CLEAR(Mail);
    IF Result <> '' THEN
    ERROR(Text003,Result);
    END;
    ...
    Replacement code
    ...
    BEGIN
    WITH SMTPMailSetup DO
    Result :=
    Mail.Send(

    // Add the following lines.
    "SMTP Server",
    "SMTP Server Port",
    Authentication <> Authentication::Anonymous,
    "User ID",
    Password,
    "Secure Connection");
    // End of the lines.

    Mail.Dispose;
    CLEAR(Mail);
    IF Result <> '' THEN
    ERROR(Text003,Result);
    END;
    ...

Prerequisites

You must have one of the following products installed to apply this hotfix:
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)

Removal information

You cannot remove this hotfix.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2345735 You cannot change the default port for SMTP Communication in Microsoft Dynamics NAV

More Information

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 2499881 - Last Review: Jan 31, 2017 - Revision: 3

Microsoft Dynamics NAV 2009

Feedback