You need to grab the MAIL API from JAVA. And put the Activation and mail
JAR's in you classpath. After that simply do the following.
import javax.mail.*;
import javax.mail.internet.*;
void emailsender()
{
boolean debug = false;
boolean sendmultipart = false;
Properties props = new Properties();
// For example mailhost.iabg.de as my mail host
props.put("mail.host", "YOUR MAIL HOST");
Session ses = Session.getDefaultInstance(props, null);
ses.setDebug(debug);
// Construct the body of the email
String msgText =
"==============================================================\n\n" +
"From : [EMAIL PROTECTED] \n" +
"To : [EMAIL PROTECTED] \n" +
"Date : " + getdatestring() + "\n\n" +
"==============================================================\n\n" +
"Some other stuff which makes up your mail..... Such as
Lets have less violence in the world!!!\n\n" +
"SAMOC/MOCCA Configuration Managment System - Keith
Ball, IABG GbmH.";
try {
Message msg = new MimeMessage(ses);
// Wheres the mail going to ?
InternetAddress[] address = {new InternetAddress([EMAIL PROTECTED])};
// Give it a return address
Address fromadd = new InternetAddress("[EMAIL PROTECTED]");
msg.setFrom(fromadd);
msg.setRecipients(Message.RecipientType.TO, address);
// Give it a subject.
msg.setSubject("This is mail from somewhere");
msg.setContent(msgText, "text/plain");
msg.setSentDate(new Date());
Transport.send(msg);
} catch (MessagingException mex) {
mex.printStackTrace();
}
There you go, have fun mailing people as someone else. Hey but be carefull
they can still trace you, cause JAVA sticks a Security tag on each mail it
sends. Clever eh ?
Keith
---------------------------------------------------------------------------
Keith Ball - Praktikant
AF12 Operationelle Analysen Luftwaffe
IABG MbH Einsteinstr. 20 85521 Ottobrunn
Phone : 0049-89-6088-2556
Email : [EMAIL PROTECTED] WWW site : www.iabg.de
----------------------------------------------------------------------------
----- Original Message -----
From: Ivan Hajicek <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 18, 1999 3:46 PM
Subject: Re: Mail from servlet
> [EMAIL PROTECTED] on 15.10.99 08:32:35
> Please respond to [EMAIL PROTECTED]
>
>
> To: [EMAIL PROTECTED]
> cc:
>
> Subject: Mail from servlet
>
>
> Hi dear all,
> How can I send mail from servlets. Please help me.
> Rashid.
>
>
___________________________________________________________________________
> 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
>
___________________________________________________________________________
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