Solved

Issue in sending e-mail

Posted on 2007-12-02
20
229 Views
Last Modified: 2010-03-30
Hey experts,

Two questions:

 1- Does Apache have a local mail server like IIS from which you can send an e-mail programmatically?

 2- I am using the example in this link http://snippets.dzone.com/posts/show/3328  to send an e-mail via an authenticated smtp server, but I am getting this exception: java.security.AccessControlException: access denied (java.net.SocketPermission..etc). I searched on the internet and saw that there is a policy file java.policy that is located in jdk1.5.0\jre\lib\security that you should modify to grant permission for access to the server. I am not sure I quite understand how this would work between a local development environment and a server production environment; would the policy file modifications remain the same and why are they done in the compiling tool; can someone explain to me more about this policy file and how the changes should be in it?
0
Comment
Question by:mte01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 8
  • 2
20 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20391398
>>1- Does Apache have a local mail server like IIS from which you can send an e-mail programmatically?

No a web server and a mail server are two distinct pieces of software

2 Once you've installed a mail server, you need to alter the policy file to allow connection to the server
0
 
LVL 3

Author Comment

by:mte01
ID: 20391431
>>2 Once you've installed a mail server, you need to alter the policy file to allow connection to the server

Where is this policy file on the server? Is it dependent on the technology/platform of this server?

If this smtp server is provided to me via a provider, I would need to ask the provider to change this policy file; right?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20391443
Normally there isn't a security manager installed. Are you by any chance using Tomcat?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 3

Author Comment

by:mte01
ID: 20391670
>>CEHJ

No, the web server is just Apache; and the mail server I am trying to send e-mail using it is smtp.bartholomusic.com, so I would need to ask the mail provider of my client for this policy file thing; right?

If I was using Tomcat as the web server, what would have differed?
0
 
LVL 3

Author Comment

by:mte01
ID: 20391684
Note that my client is using a local production server (on which the web app which he wants to use to send an e-mail is running) (he isn't using something with bartholomusic.com suffix)

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20391723
>>on which the web app which he wants to use to send an e-mail is running

Web apps (in Java) require more than Apache running. Where is the Java with this security policy running?
0
 
LVL 3

Author Comment

by:mte01
ID: 20391747
>>Web apps (in Java) require more than Apache running

Actually it's just an applet with php...that's why it works with only Apache

>>Where is the Java with this security policy running?

Can you rephrase this question based on my answer above?

And can you answer my other questions above?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20391827
>>Actually it's just an applet with php...that's why it works with only Apache

OK (although technically it will still required php modules to be installed) - i thought you could be running Java on the server side

>>Can you rephrase this question based on my answer above?

Based on what you wrote, i assume that the Java is running on the client (to run the applet)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20391831
If that's the case, an applet can only connect to the machine from which it was downloaded without being signed
0
 
LVL 3

Author Comment

by:mte01
ID: 20391902
>>although technically it will still required php modules to be installed

Yes; they are installed

>>i assume that the Java is running on the client (to run the applet)

That's right

>>If that's the case, an applet can only connect to the machine from which it was downloaded without being signed

Ok; then what's the easiest way to make/install a mail server on the local server??
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20391912
Your easiest route is to make the Apache box the mail server, then the applet can connect to it without any problem. A lot of hosting companies have smtp already running. What is the originating IP address of the applet?
0
 
LVL 3

Author Comment

by:mte01
ID: 20391974
>>What is the originating IP address of the applet?

74.133.222.122

>>A lot of hosting companies have smtp already running

The server on which the applet originates is just a local pc at my client's company; apache was installed on that pc by a previous developer of this client; is there any way to verify if he installed something for smtp other than trying to telnet?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20392088
It would not really be normal to install a mail server on a development machine. You could use your normal ISP's mail server, but then an applet would have to be signed to do so
0
 
LVL 92

Assisted Solution

by:objects
objects earned 200 total points
ID: 20392609
> 1- Does Apache have a local mail server like IIS from which you can send an e-mail programmatically?

no, but its very likely the box has smtp support. Or can be easily installed.

> 2- I am using the example in this link http://snippets.dzone.com/posts/show/3328  to send an e-mail via an authenticated smtp server, but I am getting this exception: java.security.AccessControlException: access denied

The problems not with the policy on the server, but on the client.
Its the client policy file that needs to be changed.


Best solution would be to add a mailing form on the apache server, your applet could then simply send email using it without worring about signing or policy files.

0
 
LVL 3

Author Comment

by:mte01
ID: 20401941
Ok; now I have a mail server running on the local server, but the applet still cannot connect to it because of the same AccessControlException; I guess this should be solved by some grant permissions file; any idea how?
0
 
LVL 92

Expert Comment

by:objects
ID: 20401952
> I guess this should be solved by some grant permissions file; any idea how?

you could but you'd have to do it on every client that wants to run applet

is setting up some php on the server side to senf the email an option?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20402031
>>I guess this should be solved by some grant permissions file; any idea how?

Just sign the applet
0
 
LVL 3

Author Comment

by:mte01
ID: 20402218
>>is setting up some php on the server side to senf the email an option?

Yes; I guess this seems to be the best way

There is also on the server side a java server running on a certain port on which the applet is connecting to via sockets; is it possible to send the e-mail from there too?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 20402248
>>is it possible to send the e-mail from there too?

Yes. You can get the applet to connect to a servet which can send mail with JavaMail
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20527717
:-)
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
spring jars download 1 68
How do I remove an object from a 3 63
Need Help! Getting a syntax error and don't understand why 3 55
Session in java desktop 5 39
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question