Sendmail/smart host – this time with Microsoft Azure and

FreeBSD logo


As mentioned here, my internet service provider (ISP, Eniig) has announced that they will not provide a SMTP relay host (outgoing Simple Mail Transfer Protocol relay), and on top of that they earlier stated that they will not even setup reverse DNS on my fixed IP. They recommended and it has worked flawlessly since I configured it at described here!

Unfortunately (for them) seems to have raised their prices for their low quantity “Emails To Go”-subscription, and that makes one wonder if one can get it cheaper than DKK 0.02 per e-mail :-).

It seems that if you create a Microsoft Azure account (which is free as long as you don’t use services you need to pay for – well, in fact it is even cheaper than free – they give you some introduction credits you can test their paid services with ๐Ÿ™‚ ), you can create a free account with 25,000 free e-mails a month! (even if you need more, they are still way cheaper than

Just like, requires you to use the SMTP submit port (587) and authentication. But we already solved that for as described here, so that should not cause too much hassle :-).

I just did it like this:

Add a API Key on using menu “API Keys” after logging in.
Give it a good name so you know what it is for.
Optional: Create it with “Restricted access” and only grant it permission for “Mail Send” / “Mail Send”.
Make a note of the “API Key” as it will only be shown during creation (you cannot get it afterwards).

Create /etc/mail/access with this contents (terminal it with a line break):

smtp.sendgrid.comย ย ย ย ย ย  OK
GreetPause:localhostย ย ย  0

Create /etc/mail/authinfo with one line (terminate it with a line break): "U:root" "I:apikey" "<You SendGrid API Key>" "M:LOGIN"

…replacing values in < > with the API Key you made a note of above.
Hint: You can leave other logins in here for safekeeping if you want to (like your details).
I feel most secure by making this file rw for root only

Run makemap of the two fils to create access.db and authinfo.db-files:

makemap hash access < access
makemap hash authinfo < authinfo

Correct your (whatever it is called on your system). Add these lines:

define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
FEATURE(`authinfo',`hash /etc/mail/authinfo')dnl

Note: You should change this for the sendmail queue runner process, not a SMTP submit service etc.

Compile your file into a file. This is easily done on FreeBSD ๐Ÿ™‚

make cf

Restart sendmail. Again – this is easy on FreeBSD

make restart

Also: remember to correct your SPF and similar setups on your domains according to SendGrids documentation. You’ll find SendGrids SPF documentation here!

“External Azure Active Directory” users and Single-Sign-On in Dynamics 365 Business Central

Dynanmics 365 Business Central logo

If you are setting up Single-Sign-On (SSO) for Dynamics 365 Business Central (DBC) and you are only able to authenticate users local to the Azure Active Directory (i.e. non Guest or “External Azure Active Directory” users), then you might have stumbled across the same error as me.

The error manifests itself by allowing you to log in using SSO, but just when the DBC webclient is suppose to open, you get this error:

Your user name or password is incorrect, or you do not have a valid account in Dynamics 365 Business Central.

The problems is that a user with that authentication e-mails IS in fact present in DBC – so the error makes no sense.

Also you will sometimes get a warning in the Event Viewer that the SSO token was valid, but the user could not be found in DBC.

As mentioned the local domains works fine, it is only if you try to add external users and authenticate with those it does not work:

User type: Guest
Source: External Azure Active Directory

I’ve seen this error in Microsoft Dynamics 365 Business Central 2018 fall release with cumulative update 1 and 2.

I’m aware that you – with powershell – can change a User type Guest to a User type Member. I tried it, but the result was the exact same. So “no cigar” for that solution.

After upgrading the platform to the latest Cumulative Update (which is 7 while I’m writing this), the error is completely gone. So there you have your fix :-).

Note: I’ve not tested all the CUs between 2 and 7 to figure out when it was fixed or if there is a entry in the fix list that mentions this – so if you have more knowledge about that, please share by adding a comment.

Arduino IDE v1.8.9, esp32 v1.0.2 and ulptool v2.3.0

Arduino logo

Are you messing with ultra low power esp32 code and have tried to setup the ulptool example from duff2013s GitHub in Arduino IDE v1.8.9 with Espressif Systems esp32 v1.0.2?

Maybe you got a lot of strange compile errors like these?

Traceback (most recent call last):
 File "C:\Users\<your user name>\AppData\Local\Arduino15\packages\esp32\tools\ulptool\src/", line 506, in 
 File "C:\Users\
<your user name>\AppData\Local\Arduino15\packages\esp32\tools\ulptool\src/", line 106, in main
 build_ulp(PATHS, ulp_files, board_options, True)
 File "C:\Users\
<your user name>\AppData\Local\Arduino15\packages\esp32\tools\ulptool\src/", line 136, in build_ulp
 proc = subprocess.Popen(cmd[1],stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=False)
 File "C:\Python27\lib\", line 394, in init
 errread, errwrite)
 File "C:\Python27\lib\", line 644, in _execute_child
 WindowsError: [Error 2] The system cannot find the file specified
 exit status 1
 Error compiling for board ESP32 Dev Module.

Note: This error is also reported here:

It is quite a simple fix: The error is probably caused by Espressif Systems moving around some files in esp32 v.1.0.2 – or actually renaming a catalog.

You just need to edit a single file in ulptool v2.3.0. Simply open your platform.local.txt file and change the line:




…and you are “back in business” :-).

DBC: “An error occurred while trying to display the report.”

Dynanmics 365 Business Central logo

If you get this error when you try to preview a report in Dynamics 365 Business Central:

An error occured while trying to display the report

An error occurred while trying to display the report.

…your firewall may be to restrictive.

A symptom of the same error is if you hit the Print button instead of the Preview button, and the preview during printer selection shows a “403 – Forbidden: Access is denied”-error.

We have seen this on Azure Firewall when it was set to “Prevention mode” instead of “Detection mode”. I guess one could whitelist the requests and keep “Prevention mode”, but how to do that is off cause Firewall dependent and outside the scope of this posts.

If you have a solution for your firewall, feel free to add it as a comment :-).

Broken Microsoft Dynamics 365 Business Central Single-Sign-On with Multi-Tenancy setup

Dynanmics 365 Business Central logo

After having a Single-Sign-On (towards Azure Active Directory)/Multi-Tenancy setup running on Dynamics NAV 2018 for some time, I tried to create the same setup with Microsoft Dynamics 365 Business Central 2018 fall release.

And to my surprise it failed with this error just after logging in: “The value for the WSFederationLoginEndpoint configuration settings cannot be empty.”. My “WSFederationLoginEndpoint” setting was NOT empty, so the error does not make any sense.

The value for the WSFederationLoginEndpoint configuration settings cannot be empty.
The value for the WSFederationLoginEndpoint configuration settings cannot be empty.

It puzzled me for a while because these setups was working without any problems:

  • Dynamics NAV 2018, Single Tenant
  • Dynamics NAV 2018, Multi Tenant
  • Dynamics 365 Business Central 2018 fall release, Single Tenant

So the Single Tenant BC was working, but failed as soon as I configured it for Multi Tenancy.

Finally after weeks of messing around I gave up and reached out to my contacts from Microsoft Development Center Copenhagen to see if they could help me solve the issue (first I off cause raised a ticket with Microsoft Support). Luckily Freddy from knew exactly what was wrong with my setup – and was able to send me the exact solution. And made the effort to do this on a Saturday morning! ๐Ÿ™‚

THANK YOU FREDDY ๐Ÿ™‚ !!! – please click here to visit his blog!

Oh – I almost forgot. If you have this error, empty these configurations settings from the Service Tier:

  • AzureActiveDirectoryClientId
  • AzureActiveDirectoryClientSecret

These two settings are used in Dynamics NAV 2018, but should be left empty in Microsoft Dynamics 365 Business Central.

Broken AL in Visual Studio Code October 2018 release (1.29)

Visual Studio Code logo

October 2018 release (1.29) for Visual Studio Code was just released, but unfortunately it breaks the possibility to publish AL extensions to your Dynamcs NAV / 365 Business Central.

Don’t blame the guys behind Visual Studio Code, this one is probably on the AL extension guys.

Only solution i know is to downgrade Visual Studio Code to the September 2018 (1.28.2) release or earlier for now, but I’m sure it will be fixed in the next CUs for NAV/BC.

The symptoms of this error is:

  • When publishing you don’t get any output in the VSC DEBUG CONSOLE. Only the OUTPUT shows the “normal” behaviour.
  • The Web Client won’t start after the publish.
  • The extension is not published if you start Web or Windows Client manually and check.
  • Your Windows Event Viewer will have several errors from your NAV Service tier with lots of call stack for each attempt to publish. The important text to search for is errors like:
    • Message (InvalidOperationException): RootException: InvalidOperationException
      This operation cannot be performed after the response has been submitted.
    • Message Failed request — Method:GET; Url:http://localhost:7349/NAV130_GSL/dev/metadata; StatusCode:InternalServerError; ReasonPhrase:Internal Server Error; Token:
    • Message (InvalidOperationException): RootException: InvalidOperationException
      Dynamic operations can only be performed in homogenous AppDomain.

The missing AL language support for VSC October 2018 release (1.29) was mentioned very briefly at NavTechDays 2018 in one of the first sessions (forgot which one), but I’ve not been able to find it on Google, so that is why i provide this blog post.

These kind of errors is almost impossible to trouble shoot if you cannot Google them :-).

Hint: Visual Studio Code will auto-update to the newest release automatically. To disable this, go to File/Preferences/Settings and change the “” to “none”. I highly recommend that you return this setting to its original value when the AL-language guys fix this error.

Cent and Yen in Dynamics NAV 2018

Microsoft Dynamics NAV logo

If you run a Danish Dynamics NAV and get objects from outside Denmark, you might experience the Danish letter รธ/ร˜ beeing replaced by ยข/ยฅ (the sign for Cent and Yen).

The fix?
Simply export all your objects as text, run them through the following powershell and import them again.

(((Get-Content -encoding Oem "InFile.txt") -replace ([char]8250),([char]251)) -replace ([char]157),([char]238)) | Set-Content -encoding Oem "OutFile.txt"


Finish off by a compile and syncronize all tables.

This is off cause on your own risk, so start by taking a full backup of your NAV system/server.

2018-12-20 Updated: powershell improved and now using unicode values of chars

My Dynamics NAV App is FUBAR (updated 2018-06-22 with new solution)

Microsoft Dynamics NAV logo

For readers not knowing what FUBAR is, please see Wikipedia.

If you Dynamics NAV 2018 service will not start (or actually shuts down immediately when you try to start it), and you get something like this in your Windows Event Viewer (App Name, object ID and/or Name can probably be different ones):

Message: <ii>An error occurred while applying changes from the 'Payment and Reconciliation Formats (DK) by Microsoft 1.0.20348.0' app to the application object of type 'PageExtension' with the ID '13623'. The error was: InvalidOperationException - Metadata delta application failed due to the following error(s): The metadata object IncomingDocAttachFile was not found.</ii>

…your installation is FUBAR (or at least I don’t know how to repair it easily).

PowerShell cannot uninstall/unpublish the App when no Service Tier is running – so that is not an option.


Also I was not able to Google a solution, but here is what I did to make the service tier run again:

  • Take a fresh backup, and make sure nobody will open NAV until you say OK (it will be possible as soon as we get the Service Tier running again).
  • Export all your objects to text and locate (search for) the (probably page) object with the metadata object that could not be found (i.e. “IncomingDocAttachFile” in my example). I found it in Page Object 25.
  • Export the (Page) Object to a FOB-file (just so you have it).
    Overwrite/reimport the (Page) Object from a backup without your latest changes (be warned – if this is a table object, this will empty the table – so make sure to preserve the data somehow).
  • Redo your changes to the object without messing with the metadata object that could not be found (i.e. “IncomingDocAttachFile” in my example.

Test that everything is ok, before letting anyone work again.


NOTE: I’ve not tried this with a table object, only a page object – so I’m not even sure this error can occur on tables?


DISCLAIMER: This is probably unsupported by Microsoft and you should do this on your own risk. We will not be responsible for any problems, data loss or down time etc. you may discover/experience following this procedure, or after doing this procedure. You are on your own here – but hopefully this will help you and save you the effort of finding a solution yourself! ๐Ÿ™‚


2018-06-22 I did’nt quite nail the solution first time around, as the problem creped in again. So I change the solution to the right one ๐Ÿ™‚

Commodore 64 s/n U.K.B1717794 Repair Log (Work In Progress)

Commodore logo

Do you have a defective / non working Commodore 64 breadbin?
I probably want it!
Make me an offer on and state if you want to sell it or swap it for this working one (you will have to pay my costs in parts and shipping – but not my time) ๐Ÿ™‚


Purchased 22th August 2017 on eBay:

  • Breadbin: SER.NO.U.K.B1717794
  • Motherboard: S/N 938896, assy No. 250407, artwork no. 251137, rev. B. Made in Hong Kong



  • U1: CIA, MOS 6526, week 25, 1984
  • U2: CIA, MOS 6526, week 19, 1984
  • U3: BASIC ROM, MOS 901226-01, week 25, 1984
  • U4: Kernal ROM, MOS 901227-03, week 24, 1984
  • U5: Character ROM, MOS 901225-01 (no week and year)
  • U6: Color RAM, MM2114N (no week and year)
  • U7: CPU, MOS 6510, week 29, 1984
  • U17: PLA, MOS 906114-01, week 22, 1984
  • U18: SID, MOS 6581, week 25, 1984
  • U19, VIC2, MOS 6569R2, week 25, 1984
  • RAM, 8*Mitsubishi Electric M5K4164ANP


Sellers description:

Commodore 64 keyboard.
No other items with this.
I have confirmed the power light lights up when plugging my power pack in.
2 loose buttons, included. Can be glued back on.


Repair log:

  • 4 loose buttons (F1, +, C= and Run/Stop). Replaced plundgers
  • Plastic screw holes for motherboard damaged. Repaired/recreated/strengthened with hot glue
  • Cabinet screw holes damaged. Repaired/recreated with hot glue
  • F7/F8 not working – broken trace on keyboard PCB repaired
  • U25 (MOS7708, week 23, 1984) defective. Black screen but with video sync. Replaced with HD74LS257P. Board hard do desolder on because of corrosion, so damaged 3 tracks. Those repaired with wires.


Work in progress:

  • 1 wobling button (V). Glue half broken plundger if possible – otherwise replace
  • Cleaning
  • re-capping motherboard/RF-module
  • Heatsinking larger MOS chips
  • Overvoltage protection on motherboard (P6KE6.8CA)
  • Build a PSU


Costs (total DKK 800):

  • Breadbin: DKK 400,-
  • Plundgers: DKK 75,-
  • PSU (transformator, wire, connector): DKK 225,-
  • Misc.: DKK 100,-

Let me know if you will buy it for my costs when it is done ๐Ÿ™‚

Commodore 64 s/n U.K.B1309074 Repair Log (Work In Progress)

Commodore logo

Do you have a defective / non working Commodore 64 breadbin?
I probably want it!
Make me an offer on and state if you want to sell it or swap it for this working one (you will have to pay my costs in parts and shipping – but not my time) ๐Ÿ™‚


Purchased 18th August 2017 on eBay:

  • Breadbin: SER.NO.U.K.B1309074
  • PSU: Part No. 310200-04
  • Datasette: C2N, Serial No 2871008, Made in Taiwan
  • Joystick: Spectravideo, model 318-102
  • Original Commodore 64 MicroComputer User Manual, 1984, Printed in England
  • The Commodore 64 Games Book – 21 Sensational Games by Oweb Bishop, 1983, Printed in Great Britain
  • Motherboard: S/N 057894, assy No. 250425, Made in Hong Kong



  • U1: CIA, MOS 6526, week 31, 1984
  • U2: CIA, MOS 6526, week 31, 1984
  • U3: BASIC ROM, MOS 901226-01, week 28, 1984
  • U4: Kernal ROM, MOS 901227-03, 1983 (no week)
  • U5: Character ROM, MOS 901225-01, week 33, 1984
  • U6: Color RAM, MM2114N, week 24, 1984
  • U7: CPU, MOS 6510, week 31, 1984
  • U17: PLA, MOS 906114-01, week 27, 1984
  • U18: SID, MOS 6581, week 28, 1984
  • U19, VIC2, MOS 6569R2, week 35, 1984. Defective replaced by TDB
  • U31, MOS 8701, week 34, 1984. Defective replaced by TDB
  • RAM, 8*NEC D4164-2


Sellers description:

Good Commodore 64 personal computer, tape player, 1 joystick, leads + power pack.
The power pack overheated at one stage but still worked – hence the tape around it.
I have not tested to see if the power pack will still work but I would say it was much safer to use an alternative power pack!
The Commodore has not recently been tested but was working when last used and has been well looked after so I do not see there would be any problems with it.
No original packaging.


Repair log:

  • Black screen of Death. No clock on MOS 8701. Replaced
  • Grey screen of Death (blue border). VIC2 defective. Replaced.
  • Glued datasette connector (broken plastic). Ground wire torn – hidden in connector (rarely used anyway).
  • Trashed PSU as it is non-repairable (covered in un-removable epoxy). Salvaged wire/connector for Commodore 64
  • Re-capped motherboard
  • Cleaned and lubricated datasette
  • Changed both drive belts in datasette


Work in progress:

  • Heatsinking larger MOS chips
  • Put week+year of new 8701 and VIC2 in here ๐Ÿ™‚
  • Overvoltage protection on motherboard (P6KE6.8CA)
  • Re-capping datasette
  • Build new PSU
  • Clean/test joystick


Costs (total DKK 1.000):

  • Breadbin, joystick, books and datasette: DKK 500.-
  • MOS 8701: DKK 100,-
  • VIC2: DKK 175,-
  • PSU (transformator): DKK 125,-
  • Misc.: DKK 100,-

Let me know if you will buy it for my costs when it is done ๐Ÿ™‚