JavaMail works perfectly from VisualAge JAVA Editor, but as I try to execute
it for the second time from my JSP this message is the response:
__________________________________________________________
Excepciónjavax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.IOException: No content
__________________________________________________________
Any idea? Thanks!
Here you are part of the JSP code:
___________________________________________________________
<%@ page import="SendMail" %>
<jsp:useBean id="SendMail" scope="page" class="SendMail" />
<%
try
{
SendMail.envioMail();
} catch (Exception exception)
{
out.print ("Oups, problem while sending message.");
}
%>
<HTML>
<head>
(...)
____________________________________________________________
And here are the envioMail() function (I promise it works perfectly on
VisualAge) of the bean. Perhaps the problem has something to be with the
session. I'm really blank. I hope anybody can help me. Regards.
____________________________________________________________
/* LLAMADA DESDE LA JSP */
public void envioMail()
{
try
{
String host = "mail.jet.es";
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance (props, null);
msg = new MimeMessage(session);
partes.add(new MimeBodyPart());
addAddressTo("[EMAIL PROTECTED]","Gorka");
setFrom("[EMAIL PROTECTED]","SanJorge");
setSubject("ESTA ES LA PRUEBA 1");
setBody("QUE YA TE HE DICHO QUE ESTA ES LA PRUEBA 1");
send();
}catch (Exception e)
{
System.out.println("Excepción"+e);
}
}
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets