Solved

Issue in sending e-mail

Posted on 2007-12-02
20
215 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
  • 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java SE 8u111  Lot of stuff broke 11 68
more than one jdk and one jre 1 41
MySQL  on Tomcat 8 43
Facing this issue for maven proxy setting 2 9
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

813 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now