George A. Theall via plug on 5 Dec 2023 08:26:35 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] OpenSMTPD RFC 2822 Error


On Tue, Dec 05, 2023 at 11:08:04AM -0500, George A. Theall via plug wrote:
On Tue, Dec 05, 2023 at 10:46:55AM -0500, N. Albert via plug wrote:
On 12/5/2023 10:17 AM, Casey Bralla via plug wrote:

I'm building an OpenSMTPD mailer server in a virtualbox test
environment.  The test environment has a Bind9 DNS service running
that recognizes XYZ.com as a valid domain.  The test OpenSMTPD mail
server is listed in the DNS as the mail server for that domain.

I'm at the initial testing phase, but getting an RFC 2822 error.  As
far as I can tell, my message is RFC 2822 compliant, but OpenSMTPD
seems to disagree.

Can anybody see what I'm doing wrong?  Here is my test sequence:

    telnet localhost 25
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    220 T-Mail ESMTP OpenSMTPD
    ehlo xyz.com
    250-T-Mail Hello xyz.com [::1], pleased to meet you
    250-8BITMIME
    250-ENHANCEDSTATUSCODES
    250-SIZE 36700160
    250-DSN
    250 HELP
    mail from: <casey@xyz.com>
    250 2.0.0 Ok
    rcpt to: <casey@xyz.com>
    250 2.1.5 Destination address valid: Recipient ok
    data
    354 Enter mail, end with "." on a line by itself
    date: Tue, 2023-12-05 10:13:00 AM
    from: <casey@xyz.com>
    subject: Test
    This is a test eMail.
    .
    550 5.7.1 Delivery not authorized, message refused: Message is not
    RFC 2822 compliant


The logs don't add any additional detail about the error.

As far as I can tell, RFC 2822 mandates a "date:" and "From: " field
in the message data block.  I think I've got those present.  However,
OpenSMTPD is notoriously persnickety about following the RFCs.


I don't think your "Date" header is compliant. In particular, you're
missing the UTC offset at the end, which I believe is technically
required for compliance, and your format in general is non-standard. RFC
2822 itself discusses this. Something more like this is what I would expect:

Date: Tue, 5 Dec 2023 10:13:00 -0500

Also, per the SMTP RFC, there should not be a space between MAIL FROM
and :, as well as RCPT TO and :. - it looks like your example contains
spaces. OpenSMTPD appears to be tolerant of this, but other servers may
not be.


Another issue may be that the line starting "This is a test" is not
separated from the headers above it by an empty line so it's regarded
not as the message body but as a header line.  And an invalid header
since it doesn't contain a colon and header body.

Lastly, make sure the lines you are sending end with CR and LF, not CR by
itself; eg, see telnet's crlf toggle.

George
--
theall@tifaware.com
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug