tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kurt Kurniawan" <Kurt.Kurnia...@rbs.org.au>
Subject Re: Java servlet and mailing
Date Fri, 22 Feb 2002 04:08:52 GMT
one simple way to do this is using this package:

sun.net.smtp.SmtpClient  You just have to import, and it comes with the J2SE, so don't have
to do anythin'
But you need to have an SMTP server running.

import sun.net.smtp.SmtpClient;

and do : sun.net.smtp.SmtpClient sm = new sun.net.smtp.SmtpClient(mserver);

mserver is your SMTP server name. Can be the ip address if you like.
then:
	sm.from("rfrom");
    	sm.to("rto@here");

rfrom and rto can be any String type, rto have to be email address of course. then do: PrintStream
msg = sm.startMessage();

add:...
	msg.println("To: ");
    		msg.println(rto);
    		msg.print("Subject: ");
    		msg.println("your message");
    		msg.println();
sm.closeServer();

That's it ! Don't forget to try and catch to see if this throws exceptions!

From:

Kurt

*********************************************************************************
- NOTICE -
The information transmitted is intended only for the person or entity 
to which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, 
or taking of any action in reliance upon, this information by persons
or entities other than the intended recipient is prohibited.  If you 
have received this email in error, please notify the sender and delete
the material from your computer.

Internet communications are not secure.  You should scan this message 
and any attachments for viruses.  Under no circumstances do we accept 
liability for any loss or damage which may result from your receipt of 
this message or any attachments.
*********************************************************************************


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message