|
i get an error message while running the Java Email code in apache web server , something like this
Package javax.internet.mail not found in import. import javax.internet.mail.*;
can anyone let me know if i need to configure my web server in order to execute my Java Mail code in the server. It works perfectly in the local server.
Thanks,
angel
|
|
|
|
|
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>
|
|
|
|
|
What is the best way to retrieve date from a form? I use 3 combo for day, month, and year. And each time month or year were change, day were recalculate. February has 28 or 29 days. Is there a better method? Thanks
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I just wrote a Javascript date picker, but there are plenty available on the net. They all should allow you to output to a custom date format all using a single date field and not needing you to update comboboxes...
Tigra date picker/popup calendar should do you fine...
Cheers
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hockey wrote:
I just wrote a Javascript date picker
Can you show me?
Hockey wrote:
but there are plenty available on the net.
Such as?
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Google for Tigra popup calendar or date picker you'll find it...
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Nice but I think it`s too slow. Thanks
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Slow???
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Yes slow. It needs more than 1 minute to show the control.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Hi.. I'm quite new with asp programming, so any help will be greatly appreciated.
I have written an asp code that allow user to retrieve data from database.
Right now they need to either screen capture of result page or copy paste, and email the result page.
I want to make this process automated, I already have the code to send email, but I have problem to attach the result page. I was thinking to get the source of the result page and attach it to the body of email. This can be done manually by right click and view source, select all and paste it to the body message of my email program.
Anyone know the function/command to get the source of the displayed page?
Thanks a lot...
|
|
|
|
|
Off the top of my head, I can't tell you the exact code to use, but here is how I would approach it:
If you need to look up the client's result, you can have ASP act like a web browser and connect to the server to get the page. It will then store the code of the web page as a string in a variable. If you have this already in your database, then you can skip this step.
Do a global replace of < with ( and > with )
Print the string and you should see the code.
|
|
|
|
|
easy :
how did you retrieve the data ? maybe like this :
response.write rs("record1")
response.write rs("record2")
etc ...
Now lets Dim a Variable
Dim Alldata
Alldata = "Record 1 : " & rs("record1") & vbcrlf
Alldata = Alldata & "Record 2 : " & rs("record2") & vbcrlf
Alldata = Alldata & "Record 3 : " & rs("record3") & vbcrlf
etc
when finished
ObjMail.send Alldata
Thats it .
|
|
|
|
|
Hi,
I m facing a peculiar problem in report section of my web site. To give you an idea, I log every click on button 'View Report', present on my report page, in a table just to track wut reports are being used most frequently. What happens is, if the user clicks the 'View Report' button in multiple successions, multiple insertion goes to the table with just minute difference in seconds [some times just milliseconds differ]. How should I prevent this from happening? record should not get inserted if the query and data hasnt changed.
Please help !
|
|
|
|
|
why don't you get the reports pages to log the event, instead of the button? then you know for certain that they've viewed that report.
or you could perhaps have a session variable with the latest query data, and when they click on the button, check if the current query data is the same as the last query data, and afterwards set the latest data to the current data.
--
Raoul Snyman
Saturn Laboratories
e-mail: raoul.snyman@saturnlaboratories.co.za
web: http://www.saturnlaboratories.co.za/
blog: http://blog.saturnlaboratories.co.za/
linux user: #333298
|
|
|
|
|
Thanks Raoul !
Please throw some light how shall i implement this..
"why don't you get the reports pages to log the event, instead of the button?"
My requirement is, i must log every report query that goes to the server. Please suggest if i can acheive this with your suggestion.
Regards
----------
Ashu Sharma
Web Analyst
eBizneeds : stimulating innovation by technology
m: +91 9414255790
t: +91 141 510 5201, 2
f: +91 141 510 5203
e: asharma@tech.ebizneeds.net
w: www.ebizneeds.com
|
|
|
|
|
i'm not sure what you're currently doing, but let's say that the user selects a report from a drop down list, and when they click on the button, the application directs them to another page with the report. now what you can do is when that report page loads, get it to log the event.
i'm not sure what you're using, so let's see an example in c#:
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
if (!IsPostBack)<br />
{<br />
EventLogger.LogEvent(reportId, queryData);<br />
}<br />
}
reportId : some sort of identifier to say which report it is.
queryData : the data used in the query and to generate the report.
EventLogger : my event logging class
LogEvent : a static ("Shared" in vb.net i think) method that logs the event.
hope this helps.
--
Raoul Snyman
Saturn Laboratories
e-mail: raoul.snyman@saturnlaboratories.co.za
web: http://www.saturnlaboratories.co.za/
blog: http://blog.saturnlaboratories.co.za/
linux user: #333298
|
|
|
|
|
In TML there is character representation in form xx. I can get hex value of the character but how to replace xx with character, in VC++?
|
|
|
|
|
Well for thr RGB values ff = 255. Maybe it's the same with what you want?
(so AB would be 171 etc.)
To convert use the calculator in windows. You can enter a hex-value and then click on decimal. It couldn't be easier .
Hope this helps.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
i have the following DIV act like text editor and i want to make automatic line feed when the end of line end.
I need to achieve like textarea when user wrote a contious line an automatic line feed is generated , is this possible with div.
|
|
|
|
|
raed wrote:
is this possible with div.
AFIK, no; DIV is a formatting element, not a user input. Use a TextBox control with the TextBoxMode property set to MultiLine and Wrap set to True. Set the Rows property to the number of lines you want displayed at one time, MaxLength to the maximum character count.
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
Hi,
I'm trying to respond to events fired from an ActiveX control embedded in an ASP.NET webform using client side script. I can successfully do this on a standard html page served from the same web site but when I transfer my script into my webform html it does not respond to the event. This is what my my test html page looks like...
<HTML>
<HEAD>
<TITLE>ATL 3.0 test page for object GWUPload</TITLE>
</HEAD>
<BODY>
<script Language="VBScript">
<!--
Sub GWUPload_PropertyChange()
MsgBox(GWUPload.FilePath)
end sub
-->
</script>
<OBJECT ID="GWUPload" width=100% CLASSID="CLSID:2CB1B6F7-A2FB-4D97-96EF-2FD3CF6CC4D9"></OBJECT>
</BODY>
</HTML>
I've also read "HOW TO: Host ActiveX Controls in a Web Form" on MSDN and tried the Javascript version without success. I've checked all my local security settings and made sure IE will allow ActiveX to interact with scripts (my tests are all on localhost).
The ActiveX control is one of mine but the fact that I can trap the event on a standard HTML page makes me think the problem is in my ASP.NET code.
Any ideas will be appreciated.
Thanks,
Meninga
|
|
|
|
|
I have hex value of unicode character. How to add character to string? I mean like "'\x65'123". How to use hex value to access character i VC++?
|
|
|
|
|
([0-9]|[0-9]{2}), (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) - (\d{2})
I'm using this regex to match trivial dates.
However
A12, Jan, 05 is matching...
Why is this happening...shouldn't the A12 fart and stop...
I thought the above would only match 12 and choke with the presence of an alpha character...???
What am I doing wrong...?
|
|
|
|
|
Don't you need the start of line anchor?
"An expert is a person who has made all the mistakes that can be made in a very narrow field." - Neils Bohr
|
|
|
|
|
I updated to serve pack 2 on windows and now I cannot create a new web project of any kind. I get a server 500 error. I have tried searching msdn for this with no luck. I suspect it is security settings on IIs but anything I try doesn't help. I have also reinstalled all programs. Can anyone help.
|
|
|
|