Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

sending mail using JAMES

  Asked By: Matilda    Date: Jun 01    Category: Java    Views: 1115
  

i want to send email to user on (e.g)
yahoo.com using account on JAMES server?
I have tried changing settings in config.xml, when i
send the email i receive no error message but i also
receive no email on my yahoo account.i checked it for localhost it is working as i checked by OutlookExpress.
so plz guide me that how can i send mail to yahoo or other servers and for this purpose what changes i'll make in config.xml or in my java programe.
if possible then reply me soon.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Utsav Shah     Answered On: Jun 01


import java.util.Hashtable;
import javax.naming.*;
import javax.naming.directory.*;

public class MXLookup {
public static void main( String args[] ) {
if( args.length == 0 ) {
System.err.println( "Usage: MXLookup host [...]" );
System.exit( 99 );
}
for( int i = 0; i < args.length; i++ ) {
try {
System.out.println( args[i] + " has " +
doLookup( args[i] ) + " mail  servers" );
}
catch( Exception e ) {
System.out.println(args[i] + " : " + e.getMessage());
}
}
}

static int doLookup( String hostName ) throws NamingException {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial",
"com.sun.jndi.dns.DnsContextFactory");
DirContext ictx = new InitialDirContext( env );
Attributes attrs = ictx.getAttributes( hostName, new String[]
{ "MX" });
Attribute attr = attrs.get( "MX" );
if( attr == null ) return( 0 );
return( attr.size() );
}
}

 
Answer #2    Answered By: Ziza Mizrachi     Answered On: Jun 01

I think you should put your IP in authorizedAddresses and servername to enable relaying.

 
Didn't find what you were looking for? Find more on sending mail using JAMES Or get search suggestion and latest updates.




Tagged: