I am using James 3 Beta 3. The users do exist, (except not the recipient of
one, that is an external email with google as the provider)
bash james-cli.sh -h localhost -p 9999 listusers
b...@smo.tld
gr...@smo.tld
r...@smo.tld
t...@smo.tld

listusers command executed sucessfully in 539 ms.

I am able to access James Server from the terminal and send out an email
using telnet, which works just fine.

~Garvice


On Sat, Oct 15, 2011 at 12:27 AM, Norman Maurer <
norman.mau...@googlemail.com> wrote:

> Hi there,
>
> what exact version you are using? also are you sure the recipients exist at
> the james server or do you try to deliver the mailmto a remote smtpserver?
>
> bye
> norman
>
> Am Freitag, 14. Oktober 2011 schrieb Garvice Eakins <
> garviceeak...@gmail.com
> >:
> > I am having problems sending SMTP messages from James3.0 using a simple
> java
> > application using javamail.
> >
> > Here is the example I am using
> >
> > public class MailClient
> >
> >  extends Authenticator{
> >
> >  public static final int SHOW_MESSAGES = 1;
> >
> >  public static final int CLEAR_MESSAGES = 2;
> >
> >  public static final int SHOW_AND_CLEAR =
> >
> >    SHOW_MESSAGES + CLEAR_MESSAGES;
> >
> >  protected String from;
> >
> >  protected Session session;
> >
> >  protected PasswordAuthentication authentication;
> >
> >
> > public MailClient(String user, String pass, String host)  {
> >
> >    this(user, pass, host, false);
> >
> >  }
> >
> >  public MailClient(String user, String pass, String host, boolean debug){
> >
> >    from = user + '@' + host;
> >
> >    authentication = new PasswordAuthentication(user, pass);
> >
> >    Properties props = new Properties();
> >
> >    props.put("mail.user", user);
> >
> >    props.put("mail.host", host);
> >
> >    props.put("mail.debug", debug ? "true" : "false");
> >
> >    props.put("mail.store.protocol", "pop3");
> >
> >    props.put("mail.transport.protocol", "smtp");
> >
> >    //props.put("mail.smtp.auth", "true");
> >
> >    session = Session.getInstance(props, this);
> >
> >  }
> >
> >
> >
> >  public PasswordAuthentication getPasswordAuthentication(){
> >
> >    return authentication;
> >
> >  }
> >
> >
> >
> >  public void sendMessage(
> >
> >    String to, String subject, String content)
> >
> >      throws MessagingException
> >
> >  {
> >
> >    System.out.println("SENDING message from " + from + " to " + to);
> >
> >    System.out.println();
> >
> >    MimeMessage msg = new MimeMessage(session);
> >
> >    msg.setFrom(new InternetAddress(from));
> >
> >    msg.addRecipients(Message.RecipientType.TO, to);
> >
> >    msg.setSubject(subject);
> >
> >    msg.setText(content);
> >
> >    Transport.send(msg);
> >
> >  }
> >
> >
> >
> >  public void checkInbox(int mode)
> >
> >    throws MessagingException, IOException
> >
> >  {
> >
> >    if (mode == 0) return;
> >
> >    boolean show = (mode & SHOW_MESSAGES) > 0;
> >
> >    boolean clear = (mode & CLEAR_MESSAGES) > 0;
> >
> >    String action =
> >
> >      (show ? "Show" : "") +
> >
> >      (show && clear ? " and " : "") +
> >
> >      (clear ? "Clear" : "");
> >
> >    System.out.println(action + " INBOX for " + from);
> >
> >    Store store = session.getStore();
> >
> >    store.connect();
> >
> >    Folder root = store.getDefaultFolder();
> >
> >    Folder inbox = root.getFolder("inbox");
> >
> >    inbox.open(Folder.READ_WRITE);
> >
> >    Message[] msgs = inbox.getMessages();
> >
> >    if (msgs.length == 0 && show)
> >
> >    {
> >
> >      System.out.println("No messages in inbox");
> >
> >    }
> >
> >    for (int i = 0; i < msgs.length; i++)
> >
> >    {
> >
> >      MimeMessage msg = (MimeMessage)msgs[i];
> >
> >      if (show)
> >
> >      {
> >
> >        System.out.println("    From: " + msg.getFrom()[0]);
> >
> >        System.out.println(" Subject: " + msg.getSubject());
> >
> >        System.out.println(" Content: " + msg.getContent());
> >
> >      }
> >
> >      if (clear)
> >
> >      {
> >
> >        msg.setFlag(Flags.Flag.DELETED, true);
> >
> >      }
> >
> >    }
> >
> >    inbox.close(true);
> >
> >    store.close();
> >
> >    System.out.println();
> >
> >  }
> >
> > }
> >
> >
> > public class JamesConfigTest
> >
> > {
> >
> >  public static void main(String[] args)
> >
> >    throws Exception
> >
> >  {
> >
> >    // CREATE CLIENT INSTANCES
> >
> >    MailClient redClient = new MailClient("r...@smo.tld","red",
> > "192.168.55.119");
> >
> >    MailClient greenClient = new MailClient("gr...@smo.tld", "green",
> > "192.168.55.119");
> >
> >    MailClient blueClient = new MailClient("b...@smo.tld","blue",
> > "192.168.55.119");
> >
> >
> >
> >    // CLEAR EVERYBODY'S INBOX
> >
> >    redClient.checkInbox(MailClient.CLEAR_MESSAGES);
> >
> >    greenClient.checkInbox(MailClient.CLEAR_MESSAGES);
> >
> >    blueClient.checkInbox(MailClient.CLEAR_MESSAGES);
> >
> >    Thread.sleep(500); // Let the server catch up
> >
> >
> >
> >    // SEND A COUPLE OF MESSAGES TO BLUE (FROM RED AND GREEN)
> >
> >    //redClient.getPasswordAuthentication();
> >
> >    redClient.sendMessage(
> >
> >      "garvi...@h5sw.com",
> >
> >      "Testing blue from red",
> >
> >      "This is a test message");
> >
> >    //greenClient.getPasswordAuthentication();
> >
> >    greenClient.sendMessage(
> >
> >      "b...@smo.tld",
> >
> >      "Testing blue from green",
> >
> >      "This is a test message");
> >
> >    Thread.sleep(500); // Let the server catch up
> >
> >
> >
> >    // LIST MESSAGES FOR BLUE (EXPECT MESSAGES FROM RED AND GREEN)
> >
> >    blueClient.checkInbox(MailClient.SHOW_AND_CLEAR);
> >
> >  }
> >
> > }
> >
> >
> > Here is the output from the console
> >
> >  Exception in thread "main" javax.mail.SendFailedException: Invalid
> > Addresses;
> >
> >  nested exception is:
> >
> > com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.1 Authentication
> > Required
> >
> >
> >  at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1835)
> >
> > at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1098)
> >
> > at javax.mail.Transport.send0(Transport.java:195)
> >
> > at javax.mail.Transport.send(Transport.java:124)
> >
> > at MailClient.sendMessage(MailClient.java:55)
> >
> > at JamesConfigTest.main(JamesConfigTest.java:20)
> >
> > Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 530 5.7.1
> > Authentication Required
> >
> >
> >  at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1733)
> >
> > ... 5 more
> >
> > Here is the output in the JamesServer.log:
> >
> > INFO  13:38:51,436 | james.smtpserver | ID=128768368 Connection
> established
> > from Garvice-MacBook.local (192.168.55.116)
> >
> > INFO  13:38:51,477 | james.smtpserver | ID=128768368
> > org.apache.james.smtpserver.AuthRequiredToRelayRcptHook: result=2 (DENY)
> >
> > INFO  13:38:51,479 | james.smtpserver | ID=128768368
> > org.apache.james.smtpserver.JamesRcptCmdHandler: 530 [5.7.1
> Authentication
> > Required]
> >
> > INFO  13:38:51,496 | james.smtpserver | ID=128768368 Connection closed
> for
> > Garvice-MacBook.local (192.168.55.116)
> >
> >
> > Here is the SMTP:
> >
> > INFO  13:38:51,436 | james.smtpserver | ID=128768368 Connection
> established
> > from Garvice-MacBook.local (192.168.55.116)
> >
> > INFO  13:38:51,477 | james.smtpserver | ID=128768368
> > org.apache.james.smtpserver.AuthRequiredToRelayRcptHook: result=2 (DENY)
> >
> > INFO  13:38:51,479 | james.smtpserver | ID=128768368
> > org.apache.james.smtpserver.JamesRcptCmdHandler: 530 [5.7.1
> Authentication
> > Required]
> >
> > INFO  13:38:51,496 | james.smtpserver | ID=128768368 Connection closed
> for
> > Garvice-MacBook.local (192.168.55.116)
> >
> >
> > If I uncomment the line  //props.put("mail.smtp.auth", "true");
> >
> > I get this error message:
> >
> > Exception in thread "main" javax.mail.SendFailedException: Invalid
> > Addresses;
> >
> >  nested exception is:
> >
> > com.sun.mail.smtp.SMTPAddressFailedException: 503 5.7.1 Incorrect
> > Authentication for Specified Email Address
> >
> >
> >  at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1835)
> >
> > at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1098)
> >
> > at javax.mail.Transport.send0(Transport.java:195)
> >
> > at javax.mail.Transport.send(Transport.java:124)
> >
> > at MailClient.sendMessage(MailClient.java:55)
> >
> > at JamesConfigTest.main(JamesConfigTest.java:20)
> >
> > Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 503 5.7.1
> Incorrect
> > Authentication for Specified Email Address
> >
> >
> >  at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1686)
> >
> > ... 5 more
> >
> >
> > With these Logfiles:
> >
> > SMTPServer.log
> >
> > INFO  13:38:37,155 | james.smtpserver | ID=192071567 Connection
> established
> > from Garvice-MacBook.local (192.168.55.116)
> >
> > INFO  13:38:37,221 | james.smtpserver | ID=192071567
> > org.apache.james.smtpserver.SenderAuthIdentifyVerificationRcptHook:
> result=2
> > (DENY)
> >
> > INFO  13:38:37,223 | james.smtpserver | ID=192071567
> > org.apache.james.smtpserver.JamesRcptCmdHandler: 503 [5.7.1 Incorrect
> > Authentication for Specified Email Address]
> >
> > INFO  13:38:37,248 | james.smtpserver | ID=192071567 Connection closed
> for
> > Garvice-MacBook.local (192.168.55.116)
> >
> > James-Server.log
> >
> > INFO  13:38:37,155 | james.smtpserver | ID=192071567 Connection
> established
> > from Garvice-MacBook.local (192.168.55.116)
> >
> > INFO  13:38:37,221 | james.smtpserver | ID=192071567
> > org.apache.james.smtpserver.SenderAuthIdentifyVerificationRcptHook:
> result=2
> > (DENY)
> >
> > INFO  13:38:37,223 | james.smtpserver | ID=192071567
> > org.apache.james.smtpserver.JamesRcptCmdHandler: 503 [5.7.1 Incorrect
> > Authentication for Specified Email Address]
> >
> > INFO  13:38:37,248 | james.smtpserver | ID=192071567 Connection closed
> for
> > Garvice-MacBook.local (192.168.55.116)
> >
> >
> > Any help with this would be great. I'm not really sure what I"m doing
> wrong.
> > I don't know if it's a setting in james or a property I need to set in
> > JavaMail for the Transport.
> >
> > Also here is the SMTPServer.xml file
> >
> > <smtpserver enabled="true">
> >
> >  <bind>0.0.0.0:25</bind>
> >
> >  <connectionBacklog>200</connectionBacklog>
> >
> >  <tls socketTLS="false" startTLS="false">
> >
> >  </tls>
> >
> >  <connectiontimeout>360</connectiontimeout>
> >
> >  <connectionLimit> 0 </connectionLimit>
> >
> >  <connectionLimitPerIP> 0 </connectionLimitPerIP>
> >
> >  <authorizedAddresses>127.0.0.0/8</authorizedAddresses>
> >
> >  <authRequired>false</authRequired>
> >
> >  <verifyIdentity>false</verifyIdentity>
> >
> >  <maxmessagesize>0</maxmessagesize>
> >
> >  <addressBracketsEnforcement>true</addressBracketsEnforcement>
> >
> >  <handlerchain enableJmx="true">
> >
> >    <handler
> class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
> >
> >    <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
> >
> >
> >  </handlerchain>
> >
> > </smtpserver>
> >
>

Reply via email to