I have some simple Java code I use to email me notifications from programs, and it worked on a Windows 2000 machine, but on our Red Hat box I get a message that looks like this:

Code:
[root@app1 root]# java BasicMail
IOException with URLConnection or Printwriter&#58; sun.net.smtp.SmtpProtocolException&#58; 550 5.7.1 <myaddress@gmail.com>... Relaying denied. IP name lookup failed &#91;63.127.99.299&#93;

Exception in thread "main" java.lang.NullPointerException
        at BasicMail.<init>&#40;BasicMail.java&#58;33&#41;
        at BasicMail.main&#40;BasicMail.java&#58;43&#41;
&#91;root@app1 root&#93;#
This is making me think the problem is just a difference between something regarding SMTP on the Windows box and the Linux box. Here is the simple Java code that does this:


Code:
class BasicMail &#123;
    

    
    public BasicMail&#40;&#41; &#123;
        
        String message= "Here's my message.";
        
        
        java.net.URL url = null;
        java.net.URLConnection conn = null;
        java.io.PrintWriter pout = null;
    
        System.setProperty&#40;"mail.host", "my.mailhost.com"&#41;;
        
        try &#123;
            url = new java.net.URL &#40;"mailto&#58;myaddress@gmail.com"&#41;;
        &#125; catch &#40;java.net.MalformedURLException e&#41; &#123;
            System.err.println&#40;"Malformed URL in setting mailtoAddress&#58; " + e&#41;;
        &#125;
        
        try &#123;
            conn = url.openConnection&#40;&#41;;
            pout = new java.io.PrintWriter &#40;conn.getOutputStream&#40;&#41;,true&#41;;
        &#125; catch &#40;java.io.IOException e&#41; &#123;
            System.err.println&#40;"IOException with URLConnection or Printwriter&#58; " + e&#41;;
        &#125;
        
        pout.print &#40;"To&#58; My Name\n"&#41;;
        pout.print &#40;"From&#58; Tester\n"&#41;;
        pout.print &#40;"Subject&#58; My subject \n"&#41;;
        pout.print &#40;message+ "\n"&#41;;
        pout.close&#40;&#41;;
        
        
    &#125;
    
    public static void main&#40;String &#91;&#93; args&#41; &#123;
        BasicMail mailTest = new BasicMail&#40;&#41;;
    &#125;
    
&#125;