[opencms-dev] sending email?
Aleksandra
aleksandra84 at mail.net.mk
Fri Aug 19 23:04:37 CEST 2005
Ola,
I want to use jsp that will take information from html page
with forms for sending emails,how can i implement
these,explain me the jsp file,should it be static
exported?No,right?
I want to use jstl,because my server allows that.
Does anyone maybe have solve this?
My jsp till now look like this:
>>
<jsp:directive.page import="javax.mail.*"/>
<jsp:directive.page import="javax.mail.internet.*"/>
<jsp:directive.page import="java.util.*"/>
<!doctype html public "-//w3c//dtd html 4.0
transitional//en">
<html>
<%@ taglib uri="WEB-INF/c-1.0.6.tld" prefix="c" %>
<%@ taglib uri="WEB-INF/sql-1.0.6.tld" prefix="sql" %>
<%@ page pageEncoding="UTF-8" %><%@ page session="false" %>
<%@ taglib prefix="cms"
uri="http://www.opencms.org/taglib/cms" %>
<head>
<title>Eteg - Tecnologia adaptada à sua
empresa</title>
<meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html;
CHARSET=<cms:property name="content-encoding"
default="ISO-8859-1" />">
.....
<body ..>
<%
try {
String to = "******@****.com";
String from = "******@****.com";
String nome = "Nome : "+request.getParameter("nome");
Properties props = new Properties();
props.put("mail.smtp.host", "smtp2.locaweb.com.br");
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new
InternetAddress(request.getParameter("email")));
Address toAddress = new InternetAddress(to);
message.addRecipient(Message.RecipientType.TO, toAddress);
message.setSubject(request.getParameter("assunto"));
message.setContent(nome+"\n" + "Mensagem :
"+"\n"+request.getParameter("mensagem"), "text/plain");
if (request.getParameter("email")!=null &
request.getParameter("mensagem")!=null)
Transport.send(message);
out.println("<td class=\"content_title\"
valign=\"top\">Sua mensagem foi enviada!</td>");
}
catch (MessagingException e) {
out.println("<td class=\"content_title\"
valign=\"top\">Email nao pode ser enviado!</td>");
}
out.println(new java.util.Date());
%>
...
...
Please help
=========================================================
Zastedi 70% na razgovorite so stranstvo.
15 denari minuta za bilo koja zemja vo svetot.
http://www.ozone.net.mk
info telefon (02)3100.800 24h na den
=========================================================
More information about the opencms-dev
mailing list