Henning von Bargen added the comment:

I can give a little more information.
First, I created a very simple stand-alone test script (for Python >= 2.6):

#!/bin/env python
# -*- coding: utf-8 -*-

import smtplib

# Adjust these!

HOST = "smtp.nowhere.local"
PORT = 25

from_name = u"Test Python smtplib"
from_addr = u"valid.address@nowhere.local"

to_name = u"Python Test Recipient"
to_addr = u"some.addr...@yourcompany.com"

subject = "Test Nr. 1"
smtp = smtplib.SMTP(HOST, PORT, timeout=10)
smtp.set_debuglevel(1)
smtp.sendmail(from_addr, [to_addr], subject)
smtp.quit()


This script shows the same behavior, which shows that the problem is not 
related to my program, but it is indeed a problem with smtplib.py.

Unfortunately, I could only test this with Python 2.6, because I'm not allowed 
to install Python 2.7 on that machine; OTOH I have to run it on that machine to 
have access to the mail server.

The observations are:

* The message is sent (I sent it to one of my email addresses).

* Spam Assassin flags the message with additional header lines: X-Amavis-Alert: 
BAD HEADER SECTION, Missing required header field: "Date"
X-Spam-Status: No, score=-2.36 ...
* In some cases the message is silently dropped, because the missing date 
header caues a negative score; which in turn may be bad enough to classify it 
as spam, depending on the content.
* The SMTP server used here is Postfix.
* When I receive the message, a Date header is present (obviously it has been 
inserted during the message's journey through the internet).

Personal opinion: 
I think classifying a message as spam just because a practically useless header 
field is missing is bad behavior of Spam Assaassin.
Nevertheless, the standard library should try to conform to RFC 5322.
It is good practise to be forgiving while reading but pedantic while writing.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28879>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to