|Posted by Regan Heath|
in reply to a.c.edwards
Posted in reply to a.c.edwards
On Thu, 23 Jun 2005 12:10:26 +0000 (UTC), a.c.edwards <email@example.com> wrote:
> In article <firstname.lastname@example.org>, Regan Heath says...
>> On Thu, 23 Jun 2005 10:33:21 +0000 (UTC), a.c.edwards
>> <email@example.com> wrote:
>>> Can someone point me in the right direction please?
>>> I have a file with departments and email address as such:
>>> COMM : firstname.lastname@example.org
>>> MT : email@example.com
>>> ARM : firstname.lastname@example.org
>>> I need to compose an email with attachments to the address
>>> in the file and send out daily. Any assistance is appreciated.
>> This site is what I use to find RFC's on various internet protocols.
>> 2821 - Simple Mail Transfer Protocol
>> J. Klensin, Editor, April 2001. Proposed (Obsoletes RFC0821 RFC0974
>> RFC1869), txt=187K
>> Let me know if you get stuck I should be able to help.
>> (my email address is valid)
> Much appreciated. I'll start reading right away!
A short primer. (warning, subtle plug for software below)
To send an email connect to port 25 on the mail server machine (you can try this with telnet if you like), and you will recive a 2xx code plus text eg.
220 netwin.co.nz SurgeSMTP (Version 3.2b-5) http://surgemail.com
you start by introducing yourself, using HELO or EHLO (extended version) eg.
It should return a 2xx code, eg.
250 netwin.co.nz. Hello bob.com (x.x.x.x)
Next, tell it who you are sending as/from:
you should get a 2xx code, eg.
250 Command MAIL OK
Now you send recipients (you can send as many of these as you like), eg.
for each you will recieve a 2xx code, eg.
250 local recipient ok
Now, the email data command
This responds with a 3xx code, eg.
354 Command DATA Start mail input; end with <CRLF>.<CRLF>
You send the email contents, eg.
Date: Thu, 2 Jun 2005 10:14:00 +1200
From: "Regan Heath" <email@example.com>
To: "Regan Heath" <firstname.lastname@example.org>
Subject: This is a test
Content-Type: text/plain; charset=us-ascii
This is the body of the message, it's a plain text one. If you were sending attachments you'd use a "multi-part" message with MIME encoding in the binary part, typically "BASE64" encoding (there is an RFC for this too).
The line containing a single . terminates the message (meaning if you want to send a message containing a line with a single . you "dot stuff" i.e. send .. instead.
It will respond with a 2xx code for success, a 4xx code for a temporary failure and a 5xx code for permanant failure. eg.
250 message sent ok
You then QUIT (to disconnect) or RSET (if you intend to send another message). It will respond to QUIT, eg.
221 Command QUIT, disconnecting
Now all you need is the MIME encoding/Base64 RFC :)