dcsimg
please help me in socket programming.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   pushpa_kiran
Posted On:   Sunday, September 16, 2001 11:19 PM

Hi there, i have been given a project in socket programming. Task is to download all the mails from remote server to localserver. i am going through java mail tutorials. i am new to software development. please help me in this. please let me know any books i can refer to. please tell me how to go about. the first example in java mail tutorial gives error: smtp host not found. by this example can i send messages from any rediff server to any other server. my code is like this: import java.util.Properties; import javax.mail.*; import javax.mail.internet.*;    More>>


Hi there,


i have been given a project in socket programming. Task is to download all the mails from remote server to localserver.


i am going through java mail tutorials. i am new to software development.


please help me in this. please let me know any books i can refer to.
please tell me how to go about.


the first example in java mail tutorial gives error: smtp host not found.


by this example can i send messages from any rediff server to any other server.


my code is like this:




import java.util.Properties;

import javax.mail.*;

import javax.mail.internet.*;



public class MailExample {
public static void main (String args[]) throws Exception
{

String host = args[0];

String from = args[1];

String to = args[2];


// Get system properties



Properties props = System.getProperties();

// Setup mail server



props.put("smtp.id.eth.net", host );

// Get session



Session session = Session.getDefaultInstance(props, null);

// Define message



MimeMessage message = new MimeMessage(session);

// Set the from address



message.setFrom(new InternetAddress("info@e-datsource.com"));

// Set the to address



message.addRecipient(Message.RecipientType.TO,
new InternetAddress("pushpa97@rediffmail.com"));


// Set the subject



message.setSubject("Hello JavaMail");


// Set the content



message.setText("Welcome to JavaMail");


// Send message


Transport.send(message);


}

}




i have compiled it.



i am giving following command to run.
java MailExample smtp.id.eth.net info@e-datsource.com pushpa97@rediffmail.com



it is giving following error.




Exception in thread "main" javax.mail.SendFailedException: Sending Failed
nested exception is:
javax.mail.MessageException: Unknown SMTP host: SMTP.id.eth.net
nested exception is:
java.net.UnknownHostException:SMTP.id.eth.net
at javax.mail.Transport.send0(Compiled code)
at javax.mail.Transport.send(Transport.java:81)
at MailExample.main(MailExample.java:37)



please tell me where i am wrong. what are the pre requisits for this. is there some setting which i am not doing. does this examle linked with outlook express settings. please help me.



my e-mail address- pushpa97@rediffmail.com



thanx a lot



pushpa kiran

   <<Less

Re: please help me in socket programming.

Posted By:   Kahro_Raie  
Posted On:   Monday, September 17, 2001 02:50 AM

I had a similar error:

And I think that the property:
props.put("smtp.id.eth.net", host );
is wrong.


If you want to specify the smtp host use the right key. You'll find it from sending examples (witch comes with the source) and in JavaMail specification pdf(also included)


If I were you I would base my first tries on some example programs (You'll get these with the JavaMail package).

About | Sitemap | Contact