[질문] jsp 메일 보내기 에러
글쓴이: kyocloud / 작성시간: 월, 2009/05/25 - 6:18오전
좀 봐주세요~
에러가 대체 뭔 내용인지 모르겠음... ㅠ.ㅠ
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /member/send_finished.jsp:51
48: // Multi Part content
49: message.setContent(multipart);
50: //
51: Transport.send(message);
52: %>
53:
54:
Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) root cause javax.servlet.ServletException org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774) org.apache.jsp.member.send_005ffinished_jsp._jspService(send_005ffinished_jsp.java:127) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) root cause javax.mail.internet.ParseException javax.mail.internet.ParameterList.<init>(ParameterList.java:75) javax.mail.internet.ContentDisposition.<init>(ContentDisposition.java:70) javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1040) javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:790) javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:216) javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021) javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1841) javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1822) javax.mail.Transport.send(Transport.java:80) org.apache.jsp.member.send_005ffinished_jsp._jspService(send_005ffinished_jsp.java:102) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs. 밑에는 소스 코드입니다... <code> <%@ page import="java.util.*" %> <%@ page import="javax.activation.*"%> <%@ page import="javax.mail.*"%> <%@ page import="javax.mail.message.*"%> <%@ page import="javax.mail.internet.*"%> <%@ page import="javax.mail.transport.*"%> <%@ page contentType="text/html;charset=euc-kr" %> <% request.setCharacterEncoding("euc-kr"); %> <% String host = "192.168.40.128"; String charType = "euc-kr"; String name = (String)request.getParameter("name"); String from_email = (String)request.getParameter("from_email"); String to_email = (String)request.getParameter("to_email"); String subject = (String)request.getParameter("subject"); String mail_content = (String)request.getParameter("mail_content"); String file_box = (String)request.getParameter("file_box"); %> <% // Properties props = new Properties(); props.put("mail.smtp.host", host); // Session Session s = Session.getInstance(props, null); // MimeMessage MimeMessage message = new MimeMessage(s); InternetAddress addr = new InternetAddress(from_email, name, charType); message.setFrom(addr); message.setSubject(subject); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to_email)); // Multi Part Multipart multipart = new MimeMultipart(); // BodyPart Mutil Part BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText(mail_content); multipart.addBodyPart(messageBodyPart); // BodyPart Multi Part BodyPart fileBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(file_box); fileBodyPart.setDataHandler(new DataHandler(source)); fileBodyPart.setFileName(file_box); multipart.addBodyPart(fileBodyPart); // Multi Part content message.setContent(multipart); // Transport.send(message); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=euc-kr"> <meta http-equiv="content-script-type" content="text/javascript"> <meta http-equiv="content-style-type" content="text/css"> <TITLE>Sending Mail</TITLE> </head> <BODY> <table border="1"> <tr> <td>Successed Mailing! </tr> </table> </body>
Forums:
흠.. 원하시는 답은
흠.. 원하시는 답은 아니지만.. subject 를 encoding 하지 않고 계시네요. 요즘 gmail imap 땜시.. 이런 메일들이 발송되면 제목이 다 깨져서 나와서 신경이 곤두서서 제기해 봅니다.
그리고 html part 를 작성할 때는 body tag만 작성을 하는 것이 규약입니다. html tag 와 head tag는 작성하지 않는 것이 원칙 입니다. 물론 mail client들이 parsing 을 해 주기는 하지만..
댓글 달기