Thanks for the prompt replies, given below is the jsp file:
Sendmail.jsp
------------------------------------------------------------------------
<%@ page import = "MailSend" %>
<%!
MailSend ec;
%>
<html><title> Sendmail </title>
<body><center>
<br><br> Trying to send a test Email <br>
<%
ec = new MailSend();
boolean b = ec.sendConfirmation();
if(!b){
%>
There was some error in sending you a test email.<br>
<%
}else{
%>
We have been successfully able to send you an email!<br>
<%
}
%>
</center></body></html>
----------------------------------------------------------------------
The code for the bean MailSend.java is given below :
===============================================
import javax.mail.internet.*;
import javax.mail.*;
import java.util.*;
import javax.activation.*;
public class MailSend {
public MailSend(){
}
public boolean sendConfirmation(){
try{
InternetAddress OwnerEMailAddress = new
InternetAddress("[EMAIL PROTECTED]","Sachin India");
InternetAddress Emailto = new
InternetAddress("[EMAIL PROTECTED]","Sachin India");
String OwnerServer= "mail.dans-home.com";
Properties OwnerMailProperty = new Properties();
OwnerMailProperty.put("mail.transport.protocol", "smtp");
OwnerMailProperty.put("mail.smtp.host", OwnerServer);
Session OwnerSession = Session.getDefaultInstance(OwnerMailProperty,
null);
Message msg = new MimeMessage(OwnerSession);
msg.setFrom(OwnerEMailAddress);
msg.setSubject("Not Working");
msg.addRecipient(Message.RecipientType.TO, Emailto);
/*following line is throwing the error*/
msg.setContent("Was not working from dans-home", "text/plain");
Transport sendSMTP = OwnerSession.getTransport("smtp");
/*following line is throwing the error*/
sendSMTP.send(msg);
sendSMTP.close();
}catch(Exception e){
System.out.println("Error is : " + e);
return false;
}
return true;
}
public static void main(String args[]){
MailSend sac = new MailSend();
boolean b = sac.sendConfirmation();
if(b)
System.out.println("Success");
else
System.out.println("It did not work ");
}
}
================================================
Looking forward to hearing from you guys :-).
Have a nice day.
With regards,
Sachin S. Khanna.
www.emailanorder.com
----- Original Message -----
From: Paul Holser <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 28, 2000 6:12 PM
Subject: Re: Strange Bug
> the only thing i can think of is that somehow both getWriter() and
> getOutputStream() have been called on the response object in the process
> of executing the JSP and bean code. are you using different servlet
> engines (and thus possibly different page compile servlets) on the
> different servers? can you post your page?
>
> --p
>
> --
> // Paul Holser, Infrastructure Specialist
> // Phone: 972.726.4560/1.800.OBJECT1 x4560
> // E-mail: [EMAIL PROTECTED]
> // ---------------------------------------
> // ObjectSpace, Inc.
> // The Leader in Business-to-Business Solutions
> // http://www.objectspace.com
>
> > -----Original Message-----
> > From: Sachin S. Khanna [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 28, 2000 5:31 AM
> > To: [EMAIL PROTECTED]
> > Subject: Strange Bug
> >
> >
> > I have a simple jsp which uses a bean to send an email. The
> > code is working
> > fine on one server but throwing the following error on the other:
> > java.lang.IllegalStateException: Response has already been committed
> > What could be the reason for this kind of strange behaviour.
> > Have a nice day.
> > With regards,
> > Sachin S. Khanna.
> > www.emailanorder.com
> >
> > ==============================================================
> > =============
> > To unsubscribe: mailto [EMAIL PROTECTED] with body:
> > "signoff JSP-INTEREST".
> > 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
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> 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
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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