Solved

Issue in sending e-mail

Posted on 2007-12-02
20
208 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to implement Singleton Design Pattern in Java.
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.

895 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

15 Experts available now in Live!

Get 1:1 Help Now