Note to self; odd email error pmsmtp and GMX mail

Very much a note to self. (This is so specific to my messing around on FreeDOS… really just recording it here in case I need to do it again.)

Recently set up Pegasus mail on FreeDOS using pmsmtp as the sending agent. Worked great with GMX mail (which as yet does not demand 2FA). Then set up a few other things, including the correct time zone (TZ variable), and the mail sender stopped working. Specifically, I found that when I set my timezone using the sort of notation that FreeDOS has introduced (eg set TZ=AEST-11AEDT), then this gets used by Pegasus mail to construct the email, and then the mail provider (GMX) does not understand it and sends back an error message. Here is the pmsmtp32 output:

Received: 554-Transaction failed
554-Reject due to policy restrictions.
554 For explanation visit https://postmaster.gmx.net/de/case?c=hi&i=ip&v=1.145.66.107

SMTP host's expected response is missing, here. Sorry.
Mail file(s) still waiting to be sent.

And the page it points to is about nonconformance with RFC 5321 and RFC 5322.

If I change TZ to (say) EST, and make sure the time is not in the future, then the mail sends. So I have had to use a kind of batch file as a wrapper, and then use picosntp to set the time given the time zone:

[mailpull.com is just my binary-fied batch file to pull down the mail. It’s a crude way of obfuscating the password in the clear; not that it matters — the computer is pretty physically inaccessible!]

@echo off
set TZ=EST
c:\net\picosntp\picosntp /q /d5 pool.ntp.org
set startdir=%cd%
c:
cd \net2\pmail
mailpull.com
pmail -u username@gmx.com
cd %startdir%
set startdir=
set TZ=AEST-11AEDT
c:\net\picosntp\picosntp /q /d5 pool.ntp.org
date /d
time /t

So what this does is change the time zone to EST, because nothing is going to complain about a US time zone, but then resets the computer time using picosntp to make sure the time on the email is not in the future (which is also a problem), then we pull down the mail, log into Pegasus mail, write the new mails, which pmsmtp32 sends; then on exit the TZ is reset and the time is reset and then checked.

I should really save the former time zone to a variable and restore it from there, but it’s not like I am going to move the computer to a new time zone.

Works!