Hi Ritesh,
Here is what I have for the form page (really simple):
<html>
<head>
<title>Mail test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=Shift_JIS">
</head>
<h2>Mail test</h2>
<form method=Post action="servlet/SendMail" enctype="text/plain">
<p>
mail<span class="required">*</span>
<textarea rows="5" cols="40" name="content"></textarea>
</p>
<br><br>
<p><input type=submit value="Finish"></p>
</form>
</body>
</html>
-----Original Message-----
From: Ritesh Gupta [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 5:25 PM
To: [EMAIL PROTECTED]
Subject: Re: JavaMail in servlet 2
Hi Taro,
Are you going to this form from some different page ? From what
I debugged, the problem that you were getting (the excpetion that
you sent) is coming because the value that you are getting from
request is null. You can print it by putting a SOP just after the call
to find out what is the value returned by :
String content = req.getParameter("content");
This value itself is null.
How are you setting this in the previous page ?
Ritesh
----- Original Message -----
From: Taro Kondo <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 1:48 PM
Subject: Re: JavaMail in servlet 2
Yes. I realized that. But, with one ";", it doesn't send e-mail, and at the
same time, words I type in in a form doesn't show in SendMail servlet.
It seems that I am getting close to complete it though.
Taro
-----Original Message-----
From: 崔 建偉 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 4:54 PM
To: [EMAIL PROTECTED]
Subject: Re: JavaMail in servlet 2
String content = req.getParameter("content");;
please see this carefully,why is [;;]
----- Original Message -----
From: "Taro Kondo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 4:37 PM
Subject: Re: JavaMail in servlet 2
here is the code for JavaMail
-------------------------
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.mail.*;
import javax.mail.internet.*;
public class SendMail extends HttpServlet {
public void doPost (HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException {
res.setContentType("text/html; charset=\"Shift_JIS\"");
PrintWriter out = res.getWriter();
out.println("<html><head><title>");
out.println("Send mail");
out.println("</title></head><body><h3>");
out.println("Send mail");
out.println("</h3>");
try {
Properties props = new Properties();
props.put("mail.smtp.host","mail.smtp.altera.com");
props.put("mail.host","mail.altera.com");
props.put("mail.user","tkondo");
Session session = Session.getInstance(props,null);
MimeMessage msg = new MimeMessage(session);
InternetAddress[] tolist = new InternetAddress[2];
tolist[0] = new InternetAddress("[EMAIL PROTECTED]",
MimeUtility.encodeWord("recipient1","Shift_JIS","B"));
tolist[1] = new InternetAddress("[EMAIL PROTECTED]",
MimeUtility.encodeWord("recipient2","Shift_JIS","B"));
msg.setRecipients(Message.RecipientType.TO,tolist);
msg.setFrom(new InternetAddress("[EMAIL PROTECTED]",
MimeUtility.encodeWord("sender","Shift_JIS","B")));
String subject = "sent from servlet";
msg.setSubject(MimeUtility.encodeText(subject,"Shift_JIS","B"));
String content = req.getParameter("content");;
msg.setContent(content,"text/plain; charset=\"Shift_JIS\"");
// Transport.send(msg);
out.println("<p>main sent</p>");
out.println("<pre>");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
msg.writeTo(bos);
bos.close();
out.println(bos.toString("Shift_JIS"));
out.println("</pre>");
} catch (MessagingException ex) {
out.println("<p>fail sending main</p>");
}
out.println("</body></html>");
out.close();
}
}
-----Original Message-----
From: 崔 建偉 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 1:17 PM
To: [EMAIL PROTECTED]
Subject: Re: JavaMail in servlet 2
can you show your code here?
----- Original Message -----
From: "Taro Kondo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 1:12 PM
Subject: Re: JavaMail in servlet 2
> Hi Ritesh and everyone else who knows about JavaMail,
>
> I've tried pretty much everything to get my code to work, but even with
the
> successful compiration, the page doesn't work at all. Instead, I get an
> internal error shown in below. Is there anything I can do?
>
>
> Taro
=========================
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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
===========================================================================
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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
=========================
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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
===========================================================================
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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
==========================================================================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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com