Send a message from a program? |
If you need to automatically send messages from a program you can do this without having to use the SMTP protocol (although this is the best method).
To do this you will need to create the two files in the inbox\new directory (c:\spool\inbox\new by default).
The files should be named
FILEXXXXX.TX2 and
FILEXXXXX.WR2
The XXXXX represents a number (say 00001) that is used to make sure that file names do not clash if more than one file is created in the folder.
The .TX2 file is a text file in the format of RFC822. This contains the Body and Header of the message with any attachments in either MIME or UUENCODE format.
e.g.
Date: Tue, 04 May 1999 11:11:18 +0100
Message-Id: f9905041111180001@mydomain.com
From: "Program" <postmaster@mydomain.com>
To: fred@somedomain.com
Subject: An RFC 822 MIME message
ReturnPath: <>
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="==_1234567890==_"
This is a MIME-encapsulated message
--==_1234567890==_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
This is a MIME format text message
--==_1234567890==_--
The .WR2 file is the SMTP envelope. It contains the address of the sender and the recipients each on a separate line
e.g.
postmaster@mydomain.com
fred@somedomain.com
Finally when both these files have been created they should be renamed. The .WR2 file should be have the extension Rename to .WRK and rename the .TX2 file to .TXT
The mail server will process the message the next time that it scans the inbox directory.