One alternative way is to deal directly with the Socket on the Mail Server... The class listed above do it... The comments are in Portuguese, unfortunatelly (my born language...). I Hope it helps...
import java.io.*;
import java.net.*;
import java.util.*;
/**
* Classe para modelagem de e-mail
*
* @author Gustavo Adolpho Bonesso - 29/Ago/2003
*/
public class SendMail {
private boolean online = false;
private PrintWriter out = null;
private BufferedReader in = null;
private Socket socket = null;
private Vector vRecipient = new Vector(1);
private
String from = null;
private String subject = null;
private String bgColor = null;
private StringBuffer message = null;
private boolean isHtml = false;
/**
* Construtor
* @param host IP ou Host do servidor SMTP
* @param port porta de comunica��o para o servidor SMTP - valor padr�o: 25
*/
public SendMail(String host, int port) {
try {
socket = new Socket(host, port);
out = new PrintWriter(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
online = true;
} catch(Exception exception) {
System.err.println("Problem: " + exception.toString() );
}
this.from = "";
this.subject = "";
this.isHtml = false;
this.bgColor = "white";
this.message = new StringBuffer();
}
/**
* Construtor padr�o
*/
public SendMail(){
this.from = "";
this.subject = "";
this.isHtml = false;
this.bgColor = "white";
this.message = new StringBuffer();
}
/**
* Metodo que estabelece a conex�o com o servidor de e-mail
*/
public void connect(String host, int port) {
try {
socket = new Socket(host, port);
out = new PrintWriter(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
online = true;
} catch(Exception exception) {
System.err.println("Problem: " + exception.toString() );
}
}
/**
* M�todo que fecha o socket
*/
public void close() {
try {
socket.close();
} catch(IOException e) {
System.out.println(e.getMessage());
}
out.close();
try {
in.close();
} catch(IOException e) {
System.out.println(e.getMessage());
}
}
/**
* M�todo para envio de mensagens em "stream" (uma linha por vez)
* @param strOUT Mensagem a enviar
* @param getResponse diz se o m�todo deve ou n�o devolver a resposta do servidor
*/
public void send(String strOUT, boolean getResponse) throws IOException {
if(strOUT!=null) {
out.println(strOUT);
out.flush();
}
if(getResponse) {
String strIN;
if((strIN = in.readLine()) != null)
System.out.println(strIN);
}
}
/**
* M�todo Sobrecarregado - M�todo para envio de mensagens em "stream" (uma linha por vez)
* @param strOUT Mensagem a enviar
*/
public void send(String strOUT) throws IOException {
this.send(strOUT, true);
}
/**
* M�todo para setar o destinat�rio da mensagem
* @param recipient destinat�rio da mensagem
*/
public void to(String recipient){
vRecipient.addElement(recipient);
}
/**
* M�todo para setar o remetente da mensagem
* @param from remetente da mensagem
*/
public void from (String from){
this.from = from;
}
/**
* M�todo para setar o assunto da mensagem
* @param subject assunto da mensagem
*/
public void subject (String subject){
this.subject = subject;
}
/**
* M�todo para incluir uma linha ao corpo da mensagem
* @param msg mensagem a incluir
*/
public void message (String msg){
if (isHtml){
this.message.append(msg + "<br>");
} else {
this.message.append(msg + "\n");
}
}
public void message (String msg, Font font){
this.message.append(font.getHtml(msg));
}
/**
* M�todo que indica que o e-mail ser� formatado em HTML
*/
public void setHtml(){
this.isHtml = true;
}
public void setBgColor(String color){
this.bgColor = color;
}
/**
* M�todo para iniciar o processo de envio da mensagem
*/
public void go(){
try {
java.util.Date now = new java.util.Date();
String hostName = InetAddress.getLocalHost().getHostName();
this.send(null);
this.send("HELO " + hostName);
this.send("MAIL FROM: " + from);
for (int i = 0; i < vRecipient.size(); i++){
this.send("RCPT TO: " + vRecipient.elementAt(i));
}
this.send("DATA");
this.send("Date: " + now.toString(), false);
this.send("From: " + this.from, false);
this.send("Subject: " + this.subject, false);
for (int i = 0; i < vRecipient.size(); i++){
this.send("To: " + vRecipient.elementAt(i), false);
}
if (this.isHtml){
this.send("Content-type: text/html", false);
}
this.send("", false);
if (this.isHtml){
this.send("<html><body bgcolor=\"" + this.bgColor + "\">", false);
}
this.send(this.message.toString(), false);
if (this.isHtml){
this.send("</body></html>", false);
}
this.send("\n.\n");
this.send("QUIT");
this.close();
} catch (IOException e){
System.out.println(e.getMessage());
}
}
}