In a java application I have written, I successfully connect to my smtp server using the transport.connect() method, but I get a MessagingException when the transport.sendMessage() method is called. I am using an Authenticator inner class and supplying a from email address.

The error message is:
"javax.mail.MessagingException: 454 5.7.3 Client does not have permission to submit mail to this server"

However, if I send a message from my PC using Outlook Express with the same hostname, username and password configured then the email message is sent successfully.

Does anyone have any furhter ideas please?

= Session.getInstance( getProperties(), new SMTPAuthenticator() );

Message msg = new MimeMessage( session );
try {
msg.setSubject( outgoingMessage.getMessageTitle() );
msg.setFrom( new InternetAddress( fromEmail, true ) );
msg.setReplyTo( new InternetAddress[] {new InternetAddress( fromEmail, true )} );

// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();

// Fill the message
messageBodyPart.setText( outgoingMessage.getMessageText() );
Multipart multipart = new MimeMultipart();
multipart.addBodyPart( messageBodyPart );

// Add all the file attachments, or none.
File[] files = outgoingMessage.getFileAttachments();
for ( int i = 0; i < files.length; i++ ) {

messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource( files[ i ] );
messageBodyPart.setDataHandler(new DataHandler( source ) );
messageBodyPart.setFileName( files[ i ].getName() );
multipart.addBodyPart( messageBodyPart );
}

// Now put all the parts in the message
msg.setContent( multipart );

// Send the message
Transport transport = session.getTransport( SMTP_PROTOCOL );
transport.addConnectionListener( this );
transport.addTransportListener( this );
transport.connect( );
transport.sendMessage( msg, outgoingMessage.getRecipients() );
transport.close();