[lug] SMTP Headers, from perl module

Scotty Allen scotty at scottyallen.com
Tue Jul 8 16:47:28 MDT 2003

On Tue, 2003-07-08 at 14:32, Elyse Grasso wrote:
> Does anyone have any experience using the Net::SMTP perl module?
> My messages seem to be being sent without dates, and my message body 
> seems to be being seen as a malformed header when talking to a qmail 
> server on a linux host. (The script is running on a Windows client 
> machine.)
> I've used the same email subroutine before without seeing the date 
> problem.

Net::SMTP doesn't really handle much header functionality.  To have
fields like subject and date, you need to make your own header.  This is
simply a matter of adding the various necessary header fields, one per
line, to the top of the message, seperated from the main body by a
newline.  I usually add To:, From:, Subject:, and Date:.  For the date,
I usually just use the string output from localtime().

It looks like your script might be trying to add a date field, but is
doing so in the wrong format.  It should be in the form "Date: Sun, 6
Jul 2003 11:01:49 -0600" and not have any newlines between it and the
rest of the header.

Also, looks like SpamAssassin is the one complaining about the lack of a
date field.  I think qmail doesn't really care, since it timestamps it
itself anyway.


Haiku's inventor
must have had seven fingers
on his middle hand

More information about the LUG mailing list