LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-20-2005, 11:27 AM   #1
naijaguy
Member
 
Registered: Aug 2004
Posts: 88

Rep: Reputation: 15
simple mail program works on windows and not on linux


I'm not a mail admin, so I don't know much about this stuff. Basically, I have some of my programs email me results and stuff like that, and it works fine when having them send to my work address, but not to other addresses like my GMail or Yahoo. If I try that, I get message that looks like this:

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

Exception in thread "main" java.lang.NullPointerException
at BasicMail.<init>(BasicMail.java:33)
at BasicMail.main(BasicMail.java:43)
[root@app1 root]#


I'm trying to figure out what this means. I know this same program works on a Windows 2000 machine on the same network, but not on the Red Hat Linux box. In case you want more details, these servers are behind a router in a cabinet at a data center. For the sake of this conversation, say our domain is noobly.com. Our small ISP that provides internet to our office (far from the data center) is still the registrar for our domain, so emails to me@noobly.com are handled by our ISP, and they handle the DNS for our webserver that's sitting at the data center. Tech support at our ISP wrote me back to say that we need to tell the data center folks to simply create a reverse DNS entry for our IP address (63.127.99.299).

I hope that's all I need, but turnaround time on the ticket I opened might be a while, and my boss wants some of this set up soon! So, why is it that the program below works on a Windows box and not on the Linux box?


Of course I modified it slightly before posting it, but here's the basic idea:

Code:
class BasicMail {
    

    
    public BasicMail() {
        
        String message= "Here's my message.";
        
        
        java.net.URL url = null;
        java.net.URLConnection conn = null;
        java.io.PrintWriter pout = null;
    
        System.setProperty("mail.host", "my.mailhost.com");
        
        try {
            url = new java.net.URL ("mailto:myaddress@gmail.com");
        } catch (java.net.MalformedURLException e) {
            System.err.println("Malformed URL in setting mailtoAddress: " + e);
        }
        
        try {
            conn = url.openConnection();
            pout = new java.io.PrintWriter (conn.getOutputStream(),true);
        } catch (java.io.IOException e) {
            System.err.println("IOException with URLConnection or Printwriter: " + e);
        }
        
        pout.print ("To: My Name\n");
        pout.print ("From: Tester\n");
        pout.print ("Subject: My subject \n");
        pout.print (message+ "\n");
        pout.close();
        
        
    }
    
    public static void main(String [] args) {
        BasicMail mailTest = new BasicMail();
    }
    
}
 
Old 04-21-2005, 08:45 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
The only explanation that comes to my mind is the W2k mashine is routing mail thru your ISP SMTP server. Linux box connects directly, thus the reverse DNS requirement.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling a simple C++ program for Windows Baix Programming 2 03-05-2005 07:17 PM
find a simple Windows program to check my hardware is compatibale with Linux or no czy11421 Linux - Newbie 3 05-07-2004 06:00 AM
what is a good simple *cough* windows-like dialer program? visxera Linux - Newbie 2 03-25-2004 02:15 AM
How new program Install works in Linux? AskMe Linux - Newbie 4 10-19-2003 08:52 AM
::Simple Linux Program:: XxAndyxX Linux - General 15 06-15-2003 06:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration