Solved

Issue in sending e-mail

Posted on 2007-12-02
20
199 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
Comment Utility
>>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
Comment Utility
>>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
Comment Utility
Normally there isn't a security manager installed. Are you by any chance using Tomcat?
0
 
LVL 3

Author Comment

by:mte01
Comment Utility
>>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
Comment Utility
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
Comment Utility
>>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
Comment Utility
>>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
Comment Utility
>>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
Comment Utility
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
Comment Utility
>>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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
> 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
Comment Utility
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
Comment Utility
> 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
Comment Utility
>>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
Comment Utility
>>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
Comment Utility
>>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
Comment Utility
:-)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Fibonacci challenge 11 82
maven java path setting 5 49
recursion example 16 66
Java Jpanels and Jframe 8 19
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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 …

772 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

9 Experts available now in Live!

Get 1:1 Help Now