Issue in sending e-mail

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?
LVL 3
mte01Asked:
Who is Participating?
 
CEHJCommented:
>>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
 
CEHJCommented:
>>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
 
mte01Author Commented:
>>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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
CEHJCommented:
Normally there isn't a security manager installed. Are you by any chance using Tomcat?
0
 
mte01Author Commented:
>>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
 
mte01Author Commented:
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
 
CEHJCommented:
>>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
 
mte01Author Commented:
>>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
 
CEHJCommented:
>>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
 
CEHJCommented:
If that's the case, an applet can only connect to the machine from which it was downloaded without being signed
0
 
mte01Author Commented:
>>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
 
CEHJCommented:
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
 
mte01Author Commented:
>>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
 
CEHJCommented:
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
 
objectsCommented:
> 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
 
mte01Author Commented:
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
 
objectsCommented:
> 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
 
CEHJCommented:
>>I guess this should be solved by some grant permissions file; any idea how?

Just sign the applet
0
 
mte01Author Commented:
>>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
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.