Sorry about this, but I've figured out the answer. I think the only reason
nothing was appearing in the email was that I wasn't flushing the stream, so
now I do:
out = new PrintWriter (res.getWriter (), true);
and it works fine. Sorry to have made a pointless posting!
Ben
-----Original Message-----
From: Ben Coppin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 19, 1999 11:02 AM
To: [EMAIL PROTECTED]
Subject: sun.net.smtp.SmtpClient
Has anyone used sun.net.smtp.SmtpClient from a servlet? Specifically, I
would like to be able to have a generic function which takes a PrintWriter
argument, which could either be the output that gets sent back to the
screen, or could be the contents of an email...
so I've done something like this:
public void doGet (....)
{
if (showing on screen)
{
out = res.getWriter ();
do_stuff (out);
}
else
{
out = new PrintWriter (res.getWriter ());
do_stuff (out);
}
}
private void do_stuff (PrintWriter out)
{
out.println ("This may appear in an email or on the screen...");
}
but this doesn't work (screen stuff appears fine, but nothing at all appears
in the email).
Any suggestions would be appreciated! Sorry if this is a bit off-topic...
Ben
___________________________________________________________________________
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