One problem could be getting the session before adding the property of
mail.smtp.host to the properties object.
Try interchanging their order.
Have a nice day.
With regards,
Sachin S. Khanna
http://www.emailanorder.com
----- Original Message -----
From: Supreme Being <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 11, 2001 11:53 PM
Subject: JavaMail with JSP


> i succesfully downloaded the JavaMail and JAF from sun's site in order to
use them with my JSP which i'm running on JRun Studio on my win98 PC. i
added the CLASSPATH (in autoexec.bat) as told by the docs along with them.
Now what? coz nothing is working. I have this HTML page and a JSP page which
is supposed to send email...but it's not working... i'm getting a
java.SendMailException error. what do i have to do? is there something i
missed?
> The codes i'm using are as follows :
> [The HTML Page] : javamail.html
>
> <FORM action="sendjavamail.jsp" method="post">
>  <TABLE>
>   <TR>
>    <TD width="50%"><font face="arial" color=#ffdead size=2>
>     To:<BR><INPUT name="to" size="25">
>    </TD>
>    <TD width="50%"><font face="arial" color=#ffdead size=2>
>     From:<BR><INPUT name="from" size="25">
>    </TD>
>   </TR>
>   <TR>
>    <TD colspan="2"><font face="arial" color=#ffdead size=2>
>     Subject:<BR><INPUT name="subject" size="50">
>    </TD>
>   </TR>
>   <TR>
>    <TD colspan="2"><font face="arial" color=#ffdead size=2>
>     <P>Message:<BR><TEXTAREA name="text" rows=5 cols=30></TEXTAREA></P>
>    </TD>
>   </TR>
>  </TABLE>
>  <INPUT type="submit" name="cb_submit" value=" Send ">
>  <INPUT type="reset" name="cb_reset" value=" Clear ">
> </FORM>
>
> [The JSP Page] : javasendmail.jsp
>
> <%@ page
>   import=" javax.mail.*, javax.mail.internet.*,
javax.activation.*,java.util.*"
>   %>
> <html>
> <body>
> <%
>
>  try{
>    Properties props = new Properties();
>    Session sendMailSession;
>    Store store;
>    Transport transport;
>
>
>   sendMailSession = Session.getInstance(props, null);
>
>   props.put("mail.smtp.host", "smtp.jspinsider.com");
>
>   Message newMessage = new MimeMessage(sendMailSession);
>   newMessage.setFrom(new InternetAddress(request.getParameter("from")));
>   newMessage.setRecipient(Message.RecipientType.TO, new
InternetAddress(request.getParameter("to")));
>   newMessage.setSubject(request.getParameter("subject"));
>   newMessage.setSentDate(new Date());
>   newMessage.setText(request.getParameter("text"));
>
>   transport = sendMailSession.getTransport("smtp");
>   transport.send(newMessage);
>    %>
> <P>Your mail has been sent.</P>
> <%
>   }
>  catch(MessagingException m)
>   {
>   out.println(m.toString());
>   }
> %>
> </body>
> </html>
>
>
> Tell me what i'm doing wrong? or if i have to do some other thing or use
some other codes....
>
> Regards,
> T. Edison jr.
>
>
>
> ------------------------------------------------------------
> Are you a Hoboe?  Hobnob at http://www.hoboe.com
> Click here -> http://www.hoboe.com Global Mail Access
>
>
===========================================================================
> 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
>

===========================================================================
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

Reply via email to