Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Recipient address rejected: Access denied

843830Jun 19 2007 — edited Jun 19 2007
Hi,
I'm using JavaMail for the first time.
My SMTP server has a user Id and password so im using
transport.connect("esmtp.unwired.com.au","name@unwired.com.au","password");

But when I send I get the following exception (i have change the email addres but the one I use is valid):-
Exception in thread "main" javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 554 <test@dummy.com>: Recipient address rejected: Access denied

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
at mailtests.SimpleMail.main(SimpleMail.java:33)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 <test@dummy.com>: Recipient address rejected: Access denied

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1094)
... 2 more

My full simple code is:-
public static void main(String[] args) throws Exception{
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
//props.put("mail.smtp.host", "esmtp.unwired.com.au");

Session mailSession = Session.getDefaultInstance(props, null);
Transport transport = mailSession.getTransport();

MimeMessage message = new MimeMessage(mailSession);
message.setSubject("Testing javamail plain");
message.setContent("This is a test", "text/plain");
message.addRecipient(Message.RecipientType.TO,
new InternetAddress("dummy@test.com"));
Address[] from = new Address[1];
from[0] = new InternetAddress("greatcompany@ibridge.com.au");
message.addFrom(from);
//transport.connect();
transport.connect("esmtp.unwired.com.au","name@unwired.com.au","password");
if (transport.isConnected()){
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
} else {
System.out.println("HGERE");
}
transport.close();
}


Thanks for any help,

Stu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2007
Added on Jun 19 2007
1 comment
3,741 views