Title: RE: Can't seem to write to the mail-header

Try using the Java Mail extension (you also need the Java Activation Framework package).  The MimeMessage class has a setHeader(String name, String value) method.

> -----Original Message-----
> From: Jeetandra Mahtani [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 04, 1999 10:09 AM
> To: [EMAIL PROTECTED]
> Subject: Can't seem to write to the mail-header
>
>
> Hello,
> I have a servlet that needs to write information to the mail header,
> for example in the below code.
> I can write only the first field, ie the Date, to the header but the
> ones following it such as Subject are actually written in the body of
> the message. Any way to force it to write the information to
> the header.
> Any suggestions would be appreciated.
> Thanks,
> JGM
>
> public void doGet(HttpServletRequest req,HttpServletResponse res)
> throws ServletException, IOException {
>          res.setContentType("text/html");
>          PrintWriter out = res.getWriter();
>          ParameterParser parser = new ParameterParser(req);
>          String from = parser.getStringParameter("from",FROM);
>          String to = parser.getStringParameter("to", TO);
>          try{
>                  SmtpClient smtp = new SmtpClient("xyz");
>                  smtp.from(from);
>                  smtp.to(to);
>                  PrintStream msg = smtp.startMessage();
>                  msg.println("Date: " + new java.util.Date());
>                  msg.println("Subject: Sending mail in html format");
>                  msg.println();
>                  msg.println("<h3>testing html output</h3>");
>                  msg.println();
>                  smtp.closeServer();
>          }
>          catch(IOException e){
>                  out.println("Problem sending email: " + e);
>          }
>  }
>
>
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to