first thought - used the standard and supported way of sending emails.
Mail API, i believe?  interesting, 'cause i used the same class in one
of my servlets...  maybe i should go back and check that page's
functionality now that i moved it to Tomcat... :)

"Czichos, Marc" wrote:
>
> Hi,
> we use a Java servlet to collect information from a webpage and send the content via 
>email to an emailaccount. The mailing part is based on the sun.net.smtp.SmtpClient 
>class. After a Java version upgrade (1.2) on our webserver the mailing doesn't work 
>anymore. I read somewhere, that the sun.net.Smtp class is "not offically supported" 
>and subject to change.
> The servlet compiles without any error messages.
> Any idea?
>
> Here's the code:
>
> import java.io.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.lang.reflect.*;
> import java.net.*;
> import java.lang.*;
> import sun.net.smtp.SmtpClient;
>
> public class FanshopServlet extends HttpServlet
> {
>
>         public void doGet(HttpServletRequest req, HttpServletResponse res) throws 
>ServletException, IOException
>         {
>                 res.setContentType("text/plain");
>                 PrintWriter out = res.getWriter();
>
>                 String to = "[EMAIL PROTECTED]";
>                 String from = "FanshopServlet";
>
>                 String anzTshirtM = req.getParameter("T-Shirt-M");
>                 String mail = req.getParameter("mailTo");
>
>                 try {SmtpClient smtp = new SmtpClient();
>                 smtp.from(from);
>                 smtp.to(to);
>                 PrintStream msg = smtp.startMessage();
>                 msg.println("To: " + to);
>                 msg.println("Subject: Fanshop Bestellung");
>                 msg.println();
>                 msg.println("T-Shirt-M : " + anzTshirtM);
>                 msg.println("Sent by " + HttpUtils.getRequestURL(req));
>                 smtp.closeServer();
>
>                 res.sendRedirect("http://www.xx.de/shop/gcfanstuff_repost_i.htm");}
>
>                 catch (IOException e) {out.println("<HTML><body text=#AAAAAA 
>bgcolor=#000000>");
>                 out.println("xxx");
>                 out.println("</BODY></HTML>");
>                 getServletContext().log(e, "There was a problem sending email");}
>         }
> }
>
> Thanx,
>
> Marc
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to