Hi ,
The best way to do it (and U can do many other things as well ) , is to
use the MimeMessage of the javamail api . U would require the javabeans
activation framework ( jaf ) to work on it
(http://java.sun.com/beans/glasgow/jaf.html) .
In the MimeMessage U can set the subject using setSubject(String)
or U can setSentDate(Date) etc . .. U can also add headers using
addHeader(Name,value)
Hope this is what U were looking for
Mano.
On Tue, 4 May 1999, Jeetandra Mahtani wrote:
> 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
>
___________________________________________________________________________
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