-
Java SMTP problem: connects but will not send
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();
Similar Threads
-
Replies: 1
Last Post: 12-18-2005, 09:13 AM
-
Replies: 3
Last Post: 03-07-2005, 03:34 AM
-
By Brent in forum Database
Replies: 1
Last Post: 03-21-2002, 09:47 AM
-
By Brent in forum oracle.general
Replies: 0
Last Post: 02-19-2002, 01:45 PM
-
By daphne in forum ASP.NET
Replies: 1
Last Post: 12-21-2000, 04:35 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|