Posted By:
Tim_Pope
Posted On:
Tuesday, December 31, 2002 04:19 PM
The attached code generates a multipart message that matches one sent from Outlook. When received, however, nothing is displayed in the message body, though the message source is complete and can be read. I am deliberately not using JavaMail. The class MIMEbase64 encodes the message text to base64 and sends the text, but it is not getting converted back on arrival. Presumably Outlook recognizes that this is a multipart message, because it refrains from displaying the various "Content-Type:" etc. headers. But it is not picking out the actual message text and displaying it. pw is a PrintWriter connected to port 25 of the server. I urgently need this to work. Does anyone have a piece of code that works if you can't see anything wrong with the fo
More>>
The attached code generates a multipart message that matches one sent from Outlook. When received, however, nothing is displayed in the message body, though the message source is complete and can be read. I am deliberately not using JavaMail. The class MIMEbase64 encodes the message text to base64 and sends the text, but it is not getting converted back on arrival. Presumably Outlook recognizes that this is a multipart message, because it refrains from displaying the various "Content-Type:" etc. headers. But it is not picking out the actual message text and displaying it. pw is a PrintWriter connected to port 25 of the server.
I urgently need this to work. Does anyone have a piece of code that works if you can't see anything wrong with the following?
Many thanks.
pw.print("MIME-Version: 1.0"+"
");
pw.print("Subject: Testout
");
pw.print("From: Me
");
pw.print("Content-Type: multipart/alternative;
boundary="" + boundary + ""
");
pw.print("X-Priority: 3
");
pw.print("X-MSMail-Priority: Normal
");
pw.print("X-Mailer: Microsoft Outlook Express 5.50.4807.1700
");
pw.print("X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
");
pw.print("This is a multi-part message in MIME format.
");
pw.print("
--" + boundary +"
");
pw.print("Content-Type: text/plain; charset="Windows-1252"
");
pw.print("Content-Disposition: inline
");
pw.print("Content-Transfer-Encoding: base64
");
StringBuffer SB = new StringBuffer("text");
MIMEBase64.encode(pw,SB,4);
pw.print("
--" + boundary+"
");
pw.print("Content-Type: text/plain; charset="Windows-1252"
");
pw.print("Content-Disposition: inline;
");
pw.print("Content-Transfer-Encoding: base64
");
new StringBuffer("file");
MIMEBase64.encode(pw,SB,4);
pw.print("
--" + boundary + "--
");
pw.print(".
");
pw.flush();
dis.readLine();
pw.print("QUIT");
pw.flush();
<<Less