Click here to Skip to main content
15,891,431 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: do you know good web-trackers? Pin
Michael P Butler15-Jan-05 5:53
Michael P Butler15-Jan-05 5:53 
GeneralRe: i need a good web-tracker Pin
Brad Bruce15-Jan-05 3:06
Brad Bruce15-Jan-05 3:06 
GeneralRe: i need a good web-tracker Pin
includeh1015-Jan-05 3:20
includeh1015-Jan-05 3:20 
GeneralRe: i need a good web-tracker Pin
Brad Bruce15-Jan-05 3:45
Brad Bruce15-Jan-05 3:45 
Generalmenu from database JAVAScript Pin
amit__813-Jan-05 23:49
amit__813-Jan-05 23:49 
GeneralRe: menu from database JAVAScript Pin
JKroschel14-Jan-05 4:42
JKroschel14-Jan-05 4:42 
GeneralJava Mail API Pin
Member 157626913-Jan-05 8:26
Member 157626913-Jan-05 8:26 
GeneralApache Web Server Pin
13-Jan-05 7:13
suss13-Jan-05 7:13 
I am trying to setup an email facility. I am running in a Apache web server. Given below is the code. I am using Java API for email. The code works fine in the local server but throws errors in the webserver. It doesn't seem to recognize the session and Transport variable.


SendMail.jsp


<%@ page import="java.sql.*,java.io.*,java.util.*,java.text.*,java.lang.*"%>

<HTML>

<HEAD>
<TITLE>JSP Send Email</TITLE>
</HEAD>
<BODY background="../../images/Background.gif">
<CENTER>
<BR>
<%
//Read all inputs into local variables

String l_from = request.getParameter("p_from");
String l_to = request.getParameter("p_to");
String l_cc = request.getParameter("p_cc");
String l_bcc = request.getParameter("p_bcc");
String l_subject = request.getParameter("p_subject");
String l_message = request.getParameter("p_message");
String l_smtpSvr = request.getParameter("p_smtpServer");
// session.setAttribute("smtpServer",l_smtpSvr);
%>

<%

try {
StringBuffer actv_msgstr = new StringBuffer();
Properties props = System.getProperties();
props.put("mail.smtp.host", l_smtpSvr);
props.put("mail.smtp.port","25");




Message actv_msg = new MimeMessage(Session.getDefaultInstance(props,null));
InternetAddress[] actv_to = InternetAddress.parse(l_to);
actv_msg.setRecipients(Message.RecipientType.TO, actv_to);
actv_msg.setFrom(new InternetAddress(l_from));
actv_msg.setSubject(l_subject);
props.put("smtp.proxyHost","ictproxy.ks.lsil.com");

props.put("smtp.proxyPort","8080");
//actv_msg.setRecipients(Message.RecipientType.CC, l_cc);
//actv_msg.setRecipients(Message.RecipientType.BCC, l_bcc);
actv_msgstr = new StringBuffer();
actv_msgstr.append(l_message);
actv_msg.setContent(actv_msgstr.toString(),"text/plain");
Transport.send(actv_msg);
} catch(Exception e) {
out.println("Error in sending mail to : "+ e);
}

%>

<BR><BR><BR><BR><BR><BR><BR>

<FONT SIZE=4 COLOR="blue"><B>Success!</B>
<FONT SIZE=4 COLOR="black"> <HR><FONT color=green>
<B>Mail was successfully sent to </B></FONT>: <%= l_to %> <BR>
<% if (!l_cc.equals("")) { %>
<B> CCed To </B></FONT>: <%=l_cc%><BR>
<% } %>
<% if (!l_bcc.equals("")) { %>
<B> BCCed To </B></FONT>: <%=l_bcc%><BR>
<% } %>
<HR>
<FONT SIZE=3 COLOR="blue">

<A HREF="InputMail.jsp">Compose Mail</A>
</CENTER>
</BODY>
</HTML>

GeneralDate field Pin
Yulianto.12-Jan-05 13:57
Yulianto.12-Jan-05 13:57 
GeneralRe: Date field Pin
alex.barylski13-Jan-05 20:27
alex.barylski13-Jan-05 20:27 
GeneralRe: Date field Pin
Yulianto.13-Jan-05 21:43
Yulianto.13-Jan-05 21:43 
GeneralRe: Date field Pin
alex.barylski14-Jan-05 18:18
alex.barylski14-Jan-05 18:18 
GeneralRe: Date field Pin
Yulianto.14-Jan-05 19:25
Yulianto.14-Jan-05 19:25 
GeneralRe: Date field Pin
alex.barylski18-Jan-05 16:33
alex.barylski18-Jan-05 16:33 
GeneralRe: Date field Pin
Yulianto.18-Jan-05 17:48
Yulianto.18-Jan-05 17:48 
GeneralGet the source of the current displayed page Pin
robby_ghi12-Jan-05 0:09
robby_ghi12-Jan-05 0:09 
GeneralRe: Get the source of the current displayed page Pin
JKroschel14-Jan-05 5:33
JKroschel14-Jan-05 5:33 
GeneralRe: Get the source of the current displayed page Pin
bas210016-Jan-05 8:02
bas210016-Jan-05 8:02 
Generalwant to prevent un-intentional button clicks to query report Pin
ashu_sharma2111-Jan-05 18:08
ashu_sharma2111-Jan-05 18:08 
GeneralRe: want to prevent un-intentional button clicks to query report Pin
raouls11-Jan-05 18:42
raouls11-Jan-05 18:42 
GeneralRe: want to prevent un-intentional button clicks to query report Pin
ashu_sharma2111-Jan-05 18:53
ashu_sharma2111-Jan-05 18:53 
GeneralRe: want to prevent un-intentional button clicks to query report Pin
raouls11-Jan-05 20:17
raouls11-Jan-05 20:17 
Question&amp;#xxx to character? Pin
Samsung10-Jan-05 2:34
Samsung10-Jan-05 2:34 
AnswerRe: &amp;#xxx to character? Pin
V.10-Jan-05 23:19
professionalV.10-Jan-05 23:19 
GeneralDIV with automatic line feed Pin
raed9-Jan-05 19:05
raed9-Jan-05 19:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.