sendmail blah-blah@blah.com
and then you send some headers like this:
To: blah-blah
Subject: blah-blah
and then you send two newlines, and start with the body.
The last line is a solitary period, and then close the pipe. Probably don't even need the period, if I remember correctly.
Now if you want html email, send these two headers before the "To:" header:
MIME-Version: 1.0
Content-Type: text/html
Any html coding in the body should come out as html in the email. If the email routines in JSP look at all like this sendmail format, just try sticking in those two extra headers.
here's an excerpt to show how to then send a mail from a jsp page:
firstly I would recommend you make yourself a bean something like the following:
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class MailBean{
private String mailHost;
private String fromAddy;
private String toAddy;
private String subject;
private String body;
private Properties props;
public MailBean(){
mailHost = "";
fromAddy = "";
toAddy = "";
subject = "";
body = "";
props = new Properties();
}
.
.
.
(getter and setter methods)
.
.
.
public void send(){
boolean sent = false;
Properties props = new Properties();
props.setProperty("mail.smtp.host", mailHost);
Session ssn = Session.getDefaultInstance(props);
ssn.setDebug(true);
try{
InternetAddress from = new InternetAddress(fromAddy);
InternetAddress to = new InternetAddress(toAddy);
Message msg = new MimeMessage(ssn);
msg.setFrom(from);
msg.addRecipient(Message.RecipientType.TO, to);
msg.setSubject(subject);
msg.setContent(body, "text/plain");
Transport.send(msg);
sent = true;
}
catch(Exception e){
e.printStackTrace();
}
}
}
then access it from your jsp page:
<jsp:useBean id="mailer" class="MailBean" scope="request" />
.
.
.
mailer.setMailHost("localhost");
mailer.setToAddy(to);
mailer.setFromAddy(from);
mailer.setSubject(subject);
mailer.setBody(sb.toString());
mailer.send();
.
.
.
this example is from a jsp page I had running under apache and tomcat on a linux box, accessing sendmail on the same box.
As far as I'm aware to send HTML you would just change the setContent() parameters - either way there's an html example comes with the javax.mail package I think.
If that was about as clear as mud heres a couple of links which should help:
[jspinsider.com...]