How to create mail message in FRC822 format

Here is the RFC822 message sample format...which is accepted by archive mail server.
---------------------------------------------------------------------------------------
Date: Fri, 23 Sep 2011 11:33:37 +0530 (GMT+05:30)
From:sender@gmail.com
To:  archive@.............archive.psmtp.com
Cc:  archive@.............archive.psmtp.com
Message-ID: <18916478.4.1316757817734.JavaMail.user@NIC-TestUser>
Subject: Test E-Mail through Java
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="----=_Part_3_16554308.1316757817718"

------=_Part_3_16554308.1316757817718
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is part one of a test multipart e-mail.The second part is file as an attachment
------=_Part_3_16554308.1316757817718
Content-Type: text/plain; charset=us-ascii; name=testfile.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=testfile.txt



Hi,

This is a test file.
------=_Part_3_16554308.1316757817718--
----------------------------------------------------------------------------------------
How will you create this actual message format so that it can be send using java mail API ?

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Session timeout interceptor in struts 2