开发者

Java Applet Emailing Issue

开发者 https://www.devze.com 2023-02-27 09:33 出处:网络
I\'m creating a Java Applet to be used online for a company website. The applet is essentially a dynamic online form which will prompt a user for certain important order details for a product, and th

I'm creating a Java Applet to be used online for a company website.

The applet is essentially a dynamic online form which will prompt a user for certain important order details for a product, and then send an email to an address located on a company-maintained inbox. I've created the applet in a local test environment, but as I mo开发者_高级运维ve it onto a test location (located on the same webserver as the actual applet will eventually run), I am getting the following error (from the Java Console in IE):

DEBUG: can't get java.home: java.security.AccessControlException: 
access denied (java.util.PropertyPermission java.home read)

The problem (from some of the research I've done on the subject) is that the company's webserver (which runs the website) and mailserver (which is the final destination of the email, and also the SMTP server I'm trying to use with JavaMail API in order to send the email) are at different IP addresses (although located on the same network altogether). So since this applet is untrusted (and unsigned), the Applet does not have the security permissions to access the SMTP service.

I've thought of a couple ways to get around this, but I'd really appreciate some advice on the matter, should I utilize a Java Servlet with the JavaMail API in order to allow the form to send email? Or should I try to sign the applet myself and therefore allow the applet to access the company's SMTP server?

Any comments / suggestions on the matter would help, thanks a lot.


It is standard practice nowadays to only accept mail from machines that are believed to be genuine mailservers, to try and avoid receiving spam. Even if your mailserver is not set up that way now, it might be in future. So be future-proof and use a servlet!

(Another reason to use a servlet is firewalls, but that might not apply to you.)

0

精彩评论

暂无评论...
验证码 换一张
取 消