%@ page import="javax.mail.*, javax.mail.internet.*, javax.activation.*,java.util.*" %>
¸ÞÀÏ ¹ß¼Û
<%
try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props,null);
props.put("mail.smtp.host","localhost");
Message myMessage = new MimeMessage(sendMailSession);
InternetAddress iadd = new InternetAddress();
iadd.setAddress(request.getParameter("from"));
String name = new String(request.getParameter("name").getBytes("8859_1"),"euc-kr");
iadd.setPersonal(name);
myMessage.setFrom(iadd);
myMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("to")));
String subject = new String(request.getParameter("subject").getBytes("8859_1"),"euc-kr");
myMessage.setSubject(subject);
myMessage.setSentDate(new Date());
String text = new String(request.getParameter("text").getBytes("8859_1"),"euc-kr");
myMessage.setText(text);
transport = sendMailSession.getTransport("smtp");
transport.send(myMessage);
%>
¸ÞÀÏÀÌ Á¤»óÀûÀ¸·Î ¹ß¼ÛµÇ¾ú½À´Ï´Ù. ^^
<%
}catch(MessagingException e){
out.println(e);
}
%>