Hi this is the mail servlet converted into a JSP.  It works fine for me , u can try 
this



/*****************Mail.jsp****************/

<html><head>
<title>Mail using SMTP</title></head>
<%@ page language="java" import="java.sql.*, java.io.*, java.util.*, 
javax.servlet.http.*"%>
<%@ page import="javax.servlet.*, javax.mail.*, javax.mail.internet.*"%>
<%@ page session="true" buffer="12kb" autoFlush="true" errorPage="Error.jsp" 
isErrorPage="false" sThreadSafe="true"%>
<body bgcolor=DAF0FE>
<%
String host=request.getParameter("host");
String from=request.getParameter("from");
String to=request.getParameter("to");
String name=request.getParameter("name");
String subject=request.getParameter("sub");
String body=request.getParameter("body");
if (host==null)
host=request.getServerName();
if (from==null)
from="[EMAIL PROTECTED]";
if (next==null)
next="../ic/bot.html";
if (to==null)
to ="[EMAIL PROTECTED]";
if (name==null)
name ="user";
if (subject==null)
subject="Club";
if (body==null)
body="Hello "+name+",\n Thank your for visiting the site, keep visiting ...\n-club 
site";
body=body+"\n(Please do not reply this mail, This is an automatic service)";
Properties  props = new Properties();
props.put("mail.smtp.host", host);
Session mailsess = Session.getDefaultInstance(props, null);
StringTokenizer st = new StringTokenizer(to, " ,;");
int length = st.countTokens();
InternetAddress[] toAddresses = new InternetAddress[length];
for (int i = 0; st.hasMoreTokens(); i++) 
{
 toAddresses[i] = new InternetAddress(st.nextToken());
} 

Message msg = new MimeMessage(mailsess);
msg.setFrom(new InternetAddress(from));
msg.setSubject(subject);
msg.setRecipients(Message.RecipientType.TO, toAddresses);
msg.setContent(body, "text/plain");

// send
Transport.send(msg);
%>
Your mail has been sent successfully
</body>
</html>


/************************************/

But i would recoment you to use the mailer taglib available in apache site.



VTR
�{.n�+���j)m�X��ǫ�6�j˧r����[�ܬ�    �}�R<�SLZ+v(�ٚ�[h�+-��ڲ�ܢl"��w+��� 
��DD�
��I4���ޕ�ڞ�@B�'%#�I���lq��y�.�֭��i���r�z�ڽ�.��&�;)�{^��-�٥��i��ڽ�.��&���v�-����ڪf�m�������ڞ�(�
       ��;)�;)}����m����#���r��}���w^�;)��i��0�;)�{"u�ܢ


Reply via email to