SMTP for Winlink messages in PAT

450 views
Skip to first unread message

frspin

unread,
Apr 21, 2017, 4:24:34 PM4/21/17
to pat-users
PAT interface have message composition but no possibility to modify an already sent message as new message or send a message starting from a template.

All this can be made using a mail client as Thunderbird or any other client.

On Linux we can use Postfix for getting messages from mail client and translate to PAT format. For this we need a translator from mail to PAT format.
On Windows I am unable to find a solution.

It will be useful to have an "SMTP" server able to get messages from a mail client and writing mail in PAT format and in PAT user folder.
And this need to run on Linux and on Windows at last. PAT run OK in Windows 10/64 bit,

There is some libraries for do this in Python. But where can I find a specification for mail format used by PAT?

Regards

Franco Spinelli
IW2DHW

LA5NTA

unread,
Apr 21, 2017, 8:01:39 PM4/21/17
to pat-users
Hi Franco,

First of all, let me just say that I would rather focus on improving the message composer in Pat's GUI than supporting a MIME/SMTP interface. The decision to include a message composer and mailbox viewer in Pat was not taken lightly. But I realized that the major differences between a "general email" and a "winlink message" forces some constraints that is not easy to satisfy using a generic email client without careful configuration by the user.

That being said, what you are suggesting is certainly possible, and I belive you have access to all the needed functionality through the various public libraries and APIs I've developed to support the development of Pat.

Pat's mailbox structure is a simple directory structure with the raw winlink message files ("The Winlink Message Structure"). It uses a file system notification library to watch for changes to the directories, so any new/deleted messages will be automatically picked up by the Web GUI as they appear on disk.

Basically, you have two options; Read/write raw .b2f files to the mailbox directory structure on the file system directly, or use Pat's JSON API to interact with the mailbox through the HTTP daemon (as the Web GUI does).

I believe the simplest solution would be to utilize Pat's JSON API to get/post messages serialized as JSON. That way, you could write the tool in the language of your choosing. This is what the Web GUI uses to talk to the daemon process, and the API can be considered fairly stable now.

I'd be happy to go into more details on the JSON API if you decide to play with it.

As for the raw message files on disk:

It's been important to me that my effort would benefit other developers wanting to develop winlink related software or write third party tools for Pat.
This is why I decided to divide the development into two projects; wl2k-go and Pat.

wl2k-go is the "core" of Pat, and consists of several smaller libraries that implements the various build blocks used to implement Pat. The framework is provided in the hope that other developers will benefit from the long hours I've spent trying to interpret the Winlink protocol and related topics. It's in that codebase you'll find the details on the Winlink protocol implementation and how Pat interprets the Winlink Message Structure.

The package github.com/la5nta/wl2k-go/fbb implements the Message structure with (de)serialization functions:

The package github.com/la5nta/wl2k-go/mailbox contains convenient functions for reading a .b2f message file from disk:

In addition, there are several great MIME/SMTP email packages available for Go that can be used to bridge Pat's internals with a generic email client.


I will suggest that you utilize the wl2k-go/fbb package to decode/encode messages files. That way, you'll be able to guarantee compatibility. If you decide to do this rather than utilizing the JSON API, let me know and I'd be happy to give you more information.

Go packages can be compiled as shared libraries with C bindings. That way, you can utilize the wl2k-go framework with other languages than Go if you prefer. 

To summarize: There is no Pat format. Pat stores all messages in the same format as the FBB (winlink) protocol specifies, and wl2k-go provides the encode/decode functionality. The JSON API is a convenient way to GET/POST messages as JSON objects to/from Pat's mailbox.

-- 
73 de LA5NTA/Martin

Franco Spinelli

unread,
Apr 22, 2017, 3:26:31 AM4/22/17
to LA5NTA, pat-...@googlegroups.com
Il 22/04/2017 02:01, LA5NTA ha scritto:
> Hi Franco,
>
> First of all, let me just say that I would rather focus on improving the
> message composer in Pat's GUI than supporting a MIME/SMTP interface. The
> decision to include a message composer and mailbox viewer in Pat was not
> taken lightly. But I realized that the major differences between a
> "general email" and a "winlink message" forces some constraints that is
> not easy to satisfy using a generic email client without careful
> configuration by the user.
>

I agree on this approach.

RMS Express, in Windows world and for Winmor modem, have a "template"
functionality. You can define a template for a message and use it for
composing a new mail.
A PAT function for this will be welcome.

In ordinary usage of Winlink, messages are repetitive. Get a weather
forecast, get a grib file and so. Few templates for this solve the problem.

>
> To summarize: There is no Pat format. Pat stores all messages in the
> same format as the FBB (winlink) protocol specifies, and wl2k-go
> provides the encode/decode functionality. The JSON API is a convenient
> way to GET/POST messages as JSON objects to/from Pat's mailbox.
>

I will study JSON API for POST FBB messages. For this I prefer Python as
language and there is JSON library for Python.

But if you can, implement templates in PAT!

Regards and thank

Franco Spinelli
IW2DHW


Jürgen, DL8MA

unread,
Nov 21, 2017, 12:03:24 PM11/21/17
to pat-users


Am Samstag, 22. April 2017 02:01:39 UTC+2 schrieb LA5NTA:

... , or use Pat's JSON API to interact with the mailbox through the HTTP daemon (as the Web GUI does).

I believe the simplest solution would be to utilize Pat's JSON API to get/post messages serialized as JSON. That way, you could write the tool in the language of your choosing. This is what the Web GUI uses to talk to the daemon process, and the API can be considered fairly stable now.

I'd be happy to go into more details on the JSON API if you decide to play with it.


Hi

I want to connect my own server application to PAT using the JSON API.

Is there documentation about the JSON API?

Are there examples where e.g. via the JSON-API a WinLink-Mails from PAT is read out?

73 de Jürgen, DL8MA
 

LA5NTA

unread,
Nov 21, 2017, 4:17:49 PM11/21/17
to pat-users
Hello Jürgen,

the JSON API is under active development (but has remained fairly stable).

As mentioned in my reply to Franco earlier in this thread, it's primarily developed for the Web UI and it is undocumented for now. After v1.0.0, my hope is that the API is mature enough to be documented and versioned.

For now, your resources would be:

List messages in the inbox:

Get a single message:

Get an attachment:

Good luck!

-- 
73 de LA5NTA

Jürgen, DL8MA

unread,
Nov 21, 2017, 5:02:22 PM11/21/17
to pat-users
hello,

Am Dienstag, 21. November 2017 22:17:49 UTC+1 schrieb LA5NTA:
Hello Jürgen,

List messages in the inbox:

 
i got this:

root@jm:/home/jm# curl -Ssf http://localhost:8088/mailbox/in

curl
: (7) Failed to connect to localhost port 8088: Verbindungsaufbau abgelehnt


(i use Port 8088 )

73 de Jürgen :-(


 

Martin Hebnes Pedersen

unread,
Nov 21, 2017, 5:17:27 PM11/21/17
to Jürgen, DL8MA, pat-users
That error code (7) indicates that curl was not able to connect() to the given server:port. This suggests that there is no daemon listening on that port on your system. Did you forget to start pat http?

Please provide the full log output from your Pat instance.

-- 
Martin



--
You received this message because you are subscribed to the Google Groups "pat-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pat-users+unsubscribe@googlegroups.com.
To post to this group, send email to pat-...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pat-users/53b621ec-d94a-42b4-8dd2-e6973ca5e1e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jürgen, DL8MA

unread,
Nov 21, 2017, 5:24:38 PM11/21/17
to pat-users
hello,


Am Dienstag, 21. November 2017 23:17:27 UTC+1 schrieb LA5NTA:

Please provide the full log output from your Pat instance.


i started with "pat http"

there is no log output when i request via curl

73 de Jürgen, DL8MA

Torsten Harenberg

unread,
Nov 22, 2017, 2:10:54 AM11/22/17
to pat-...@googlegroups.com
Am 21.11.17 um 22:17 schrieb LA5NTA:
Looking into the source: isn't an "api" missing at the front of the
URL-path?

like:

pi@pi2 ~ $ curl -Ssf http://localhost:8080/api/mailbox/in
[{"MID":"X7K9FQUMYSYY","Date":"2017-11-17T20:32:00+01:00","From":{"Proto":"SMTP","Addr":"tor...@dl1thm.de"},"To":[{"Proto":"","Addr":"DL1THM"}],"Cc":null,"Subject":"smal
[...]

73s

de Torsten DL1THM

Jürgen, DL8MA

unread,
Nov 22, 2017, 3:49:56 AM11/22/17
to pat-users
hello,


Am Mittwoch, 22. November 2017 08:10:54 UTC+1 schrieb Torsten Harenberg:
Am 21.11.17 um 22:17 schrieb LA5NTA:
> curl -Ssf http://localhost:8080/mailbox/in

Looking into the source: isn't an "api" missing at the front of the
URL-path?

Hello, it works now with:


with "localhost" it does not work for me :-(

But if I take the Server-IP instead, the API call works and a JSON string comes back.

In the console where I called "PAT HTTP" the API call is not logged.  

mni tnks!

73 de Jürgen, DL8MA


Torsten Harenberg

unread,
Nov 22, 2017, 4:05:29 AM11/22/17
to Jürgen, DL8MA, pat-...@googlegroups.com
Hi Jürgen

----- Originale Nachricht -----
Von: "'Jürgen, DL8MA' via pat-users" <pat-...@googlegroups.com>
Gesendet: 22.11.17 - 09:49
An: pat-users <pat-...@googlegroups.com>
Betreff: Re: SMTP for Winlink messages in PAT


>
> with "localhost" it does not work for me :-(
>

You may need to adjust your pat http call. I use

pat http -a 0.0.0.0:8080

So the socket is bound to any device and I can use pat in my whole LAN. Be careful that you don't make the port visible to the whole internet.

73s

Torsten DL1THM


Jürgen, DL8MA

unread,
Nov 22, 2017, 5:37:36 AM11/22/17
to pat-users


Am Mittwoch, 22. November 2017 10:05:29 UTC+1 schrieb Torsten Harenberg:
Hi Jürgen


You may need to adjust your pat http call. I use

pat http -a 0.0.0.0:8080

So the socket is bound to any device and I can use pat in my whole LAN. Be careful that you don't make the port visible to the whole internet.


I use the port 8080 on the server already for another service. 

That's why I took 8088

73 de Jürgen, DL8MA

Torsten Harenberg

unread,
Nov 22, 2017, 5:47:35 AM11/22/17
to Jürgen, DL8MA, pat-users
Am 22.11.17 um 11:37 schrieb 'Jürgen, DL8MA' via pat-users:
> I use the port 8080 on the server already for another service. 
>
> That's why I took 8088

the important part is not the port number, but using 0.0.0.0

73s

Torsten DL1THM


Jürgen, DL8MA

unread,
Nov 22, 2017, 6:55:34 AM11/22/17
to pat-users
Yep, it works!

on the server:

root@jm:/home/jm# pat http -a 0.0.0.0:8088


2017/11/22 12:51:32 Starting HTTP service (0.0.0.0:8088)...


then is use on the same machine:

curl -Ssf localhost:8088/api/mailbox/in

and from another PC:

curl -Ssf 192.168.178.60:8088/api/mailbox/in


=> 

min tnks!

73 de Jürgen, DL8MA

 

Jürgen, DL8MA

unread,
Nov 22, 2017, 7:56:39 AM11/22/17
to pat-users
hallo,


Am Dienstag, 21. November 2017 22:17:49 UTC+1 schrieb LA5NTA:
For now, your resources would be:

List messages in the inbox:


would you have me examples to post a mail:

r.HandleFunc ("/ api / mailbox / ", postMessageHandler) .Methods ("POST")

r
.HandleFunc ("/ api / posreport", postPositionHandler) .Methods ("POST")


To read an e-mail via the JSON API works flawlessly.

Now I would like to send mails via the API.  

73 de Jürgen, DL8MA
Reply all
Reply to author
Forward
0 new messages