Send mail
main sent

Message-ID: <1903183.1027499319580.JavaMail.tosis215@hons001>
From: sender
To: recipient1 , recipient2
Subject: sent from servlet
Mime-Version: 1.0
Content-Type: text/plain; charset="Shift_JIS"
Content-Transfer-Encoding: 7bit

content   (you first set content="content")

how about this?



----- Original Message -----
From: "Taro Kondo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 5:18 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

Reply via email to