But my original question still stands. Why am I getting an authentication
error from James when I try and send emails to an external email from my
Java app?
What part am I missing, I authenticated before I checked for message, and
that works fine but not send as it does when I send internal emails.

~Garvice

On Tue, Oct 18, 2011 at 11:12 PM, Eric Charles
<[email protected]>wrote:

> Glad it is now OK.
> Thx,
> Eric
>
>
> On 19/10/11 01:30, Garvice Eakins wrote:
>
>> Eric,
>>
>> Ok I have attached an email client to the James Server (Apple Mail) I can
>> send emails to internal addresses on the same domain, and I can send
>> external emails as well.
>> Using the Java Program I submitted earlier I can send internal emails,
>> retrieve and print them to console. I can also view these emails using the
>> mail client.
>> I can also use the mail client to send internal emails. (Internal to  the
>> james server)
>>
>> ~Garvice
>>
>> On Tue, Oct 18, 2011 at 12:32 AM, Eric Charles
>> <[email protected]>**wrote:
>>
>>  You simply have to define a new email account in your favorite mail
>>> client
>>> with the username/password/host you have in James.
>>>
>>> Eric
>>>
>>>
>>>
>>> On 17/10/11 21:58, Garvice Eakins wrote:
>>>
>>>  no I have not used thunderbird or any other standard mail client, not
>>>> really
>>>> sure even how to do that.
>>>> I will search the site and see if I can find an example. If you could
>>>> provide a link to one that would be great!
>>>> I really am going blindly into this as I have almost zero knowledge
>>>> about
>>>> mail servers.
>>>>
>>>> ~Garvice
>>>>
>>>> On Mon, Oct 17, 2011 at 12:56 AM, Eric Charles
>>>> <[email protected]>****wrote:
>>>>
>>>>  Hi,
>>>>
>>>>> What Norman says + did you try from a standard mail client such as
>>>>> thunderbird to test the server conf?
>>>>> thx,
>>>>> Eric
>>>>>
>>>>>
>>>>> On 15/10/11 09:27, Norman Maurer 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<
>>>>>> [email protected]
>>>>>>
>>>>>>  :
>>>>>>
>>>>>>> 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<http://**
>>>>>>> Message.RecipientType.TO<http:**//Message.RecipientType.TO<http://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("[email protected]","red"******,
>>>>>>>
>>>>>>>
>>>>>>> "192.168.55.119");
>>>>>>>
>>>>>>>    MailClient greenClient = new MailClient("[email protected]", "green",
>>>>>>> "192.168.55.119");
>>>>>>>
>>>>>>>    MailClient blueClient = new MailClient("[email protected]","*****
>>>>>>> *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(
>>>>>>>
>>>>>>>      "[email protected]",
>>>>>>>
>>>>>>>      "Testing blue from red",
>>>>>>>
>>>>>>>      "This is a test message");
>>>>>>>
>>>>>>>    //greenClient.******getPasswordAuthentication();
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>    greenClient.sendMessage(
>>>>>>>
>>>>>>>      "[email protected]",
>>>>>>>
>>>>>>>      "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.********SenderAuthIdentifyVerification**
>>>>>>> **
>>>>>>> **RcptHook:
>>>>>>>
>>>>>>>  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.********SenderAuthIdentifyVerification**
>>>>>>> **
>>>>>>> **RcptHook:
>>>>>>>
>>>>>>>  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<http://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>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   --
>>>>>>
>>>>> Eric
>>>>> http://about.echarles.net
>>>>>
>>>>> ------------------------------******--------------------------**--**
>>>>> --**---------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.******apache.org
>>>>> <
>>>>> server-user-**unsubscribe@**james.apache.org<[email protected]>
>>>>> <server-user-**[email protected]<[email protected]>
>>>>> >
>>>>>
>>>>>>
>>>>>>  For additional commands, e-mail: [email protected].**
>>>>> ****org<
>>>>> server-user-help@james.**apach**e.org <http://apache.org><
>>>>> server-user-help@james.**apache.org<[email protected]>
>>>>> >>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>  --
>>> Eric
>>> http://about.echarles.net
>>>
>>> ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.****apache.org<
>>> server-user-**[email protected]<[email protected]>
>>> >
>>> For additional commands, e-mail: [email protected].****org<
>>> server-user-help@james.**apache.org <[email protected]>>
>>>
>>>
>>>
>>
> --
> Eric
> http://about.echarles.net
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> server-user-unsubscribe@james.**apache.org<[email protected]>
> For additional commands, e-mail: 
> [email protected].**org<[email protected]>
>
>

Reply via email to